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)num:Num,
|
||||||
pub(crate)den:Den,
|
pub(crate)den:Den,
|
||||||
}
|
}
|
||||||
//this trait is like a constructor for Ratio
|
impl<Num,Den> Ratio<Num,Den>{
|
||||||
pub trait DeferredDiv<Rhs=Self>{
|
pub const fn new(num:Num,den:Den)->Self{
|
||||||
type Output;
|
Self{num,den}
|
||||||
fn deferred_div(self,rhs:Rhs)->Self::Output;
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user