Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![allow(warnings)]
- trait Foo
- {
- type T;
- fn bar(&mut self)
- {
- println!("Core Implementation!");
- }
- }
- impl Foo<T = i32> // What's the use of this implementation if it's not accessible?
- {
- fn bar(&mut self)
- {
- println!("Default i32 Implementation!");
- }
- }
- struct Baz
- {
- }
- impl Foo for Baz
- {
- type T = i32;
- }
- // Not Allowed!
- // impl Foo<T=i32> for Baz
- // {
- // type T = i32;
- // }
- fn main()
- {
- let mut a: Box<Foo<T = i32>> = Box::new(Baz{});
- type Bunny = Foo<T=i32>;
- <Bunny as Bunny>::bar(&mut *a);
- }
Add Comment
Please, Sign In to add comment