Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct MyType;
- trait MyTrait {
- fn foo(&self);
- }
- impl<T> MyTrait for T {
- fn foo(&self) {
- println!("Hello");
- }
- }
- //impl !MyTrait for MyType {}
- fn main() {
- let mt = MyType;
- let s = "Rust";
- mt.foo();
- s.foo();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement