trait constructor doesn't work because trait bounds (and is also bad)
This commit is contained in:
parent
c43fab2f18
commit
4ae391e9fd
@ -3,8 +3,8 @@ pub struct Ratio<Num,Den>{
|
||||
pub(crate)num:Num,
|
||||
pub(crate)den:Den,
|
||||
}
|
||||
//this trait is like a constructor for Ratio
|
||||
pub trait DeferredDiv<Rhs=Self>{
|
||||
type Output;
|
||||
fn deferred_div(self,rhs:Rhs)->Self::Output;
|
||||
impl<Num,Den> Ratio<Num,Den>{
|
||||
pub const fn new(num:Num,den:Den)->Self{
|
||||
Self{num,den}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user