Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait Fooer {
- fn foo(&self) -> String;
- }
- struct Foo;
- impl Fooer for Foo {
- fn foo(&self) -> String {
- String::from_str("Hello World")
- }
- }
- fn getfoo<T>(g: T) -> String
- where T: Fooer {
- g.foo()
- }
- fn main() {
- let g = Foo;
- println!("{}", getfoo(g));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement