use std::num::Int;
fn main() {
println!("{}", add_one(4));
}
fn add_one<T: Int>(x: T) -> T {
return x + 1
}
I'm trying to make add_one generic for Int but when I compile it says types are mismatched
Error message:
src/main.rs:8:16: 8:17 error: mismatched types:
expected `T`,
found `_`
(expected type parameter,
found integral variable) [E0308]
src/main.rs:8 return x + 1
^