Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait TestTrait {
- fn say_hello(&self);
- }
- struct TestImplementorOne;
- struct TestImplementorTwo;
- impl TestTrait for TestImplementorOne{
- fn say_hello(&self){ println!("one");}
- }
- impl TestTrait for TestImplementorTwo {
- fn say_hello(&self) {println!("two");}
- }
- fn main(){
- let t = TestImplementorOne;
- t.say_hello();
- let v : Vec<TestTrait> = vec!(TestImplementorOne, TestImplementorTwo, TestImplementorOne);
- }
Add Comment
Please, Sign In to add comment