trait constructor doesn't work because trait bounds (and is also bad)

This commit is contained in:
Quaternions 2024-08-28 09:06:16 -07:00
parent c43fab2f18
commit 4ae391e9fd

View File

@ -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}
}
}