You can write:
use std::ops::Add;
fn double_it<T>(x: T) -> T
where T: Add<Output=T> + Copy + Clone {
x + x
}
fn main() {
println!("{}", double_it(21));
}
You can write:
use std::ops::Add;
fn double_it<T>(x: T) -> T
where T: Add<Output=T> + Copy + Clone {
x + x
}
fn main() {
println!("{}", double_it(21));
}