use std::ops::Mul;
pub trait TraitWithGeneric<T> {
fn evaluate(&self) ->T;
}
pub struct ImplStruct<T> {
v:T
}
impl<T> TraitWithGeneric<T> for ImplStruct<T>
where
T:Mul<f32, Output=T>,
T:Copy
{
fn evaluate(&self) -> T {
self.v * 1.2
}
}
Errors:
Compiling playground v0.0.1 (/playground)
Finished dev [unoptimized + debuginfo] target(s) in 4.69s
Hi, everyone
the above code sample works fine, but I want to know if the T has no Copy traits supported and only &T: Mul<f32, Output=T>, what should I do? Thanks.