Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![allow(warnings)]
- use std::fmt::Display;
- struct MyStruct<T> where
- T: Display,
- //T: IntoIterator, adding this extra bound, requires changing the code below
- {
- my_field: T
- }
- fn my_example(x: MyStruct<i32>)
- {
- println!("{}", x.my_field);
- }
- fn main()
- {
- println!("Hello, world!");
- my_example( MyStruct{ my_field: 42 } );
- }
Add Comment
Please, Sign In to add comment