Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // For a trait of general number
- extern crate num;
- fn add<T>(a: T, b: T) -> T where T: num::Num {
- a + b
- }
- fn main() {
- assert_eq!(5, add(3, 2));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement