Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mod thing {
- pub trait Tr {
- fn foo(&self) -> u32;
- }
- pub struct S;
- impl S {
- pub fn foo(&self) -> u32 {
- Tr::foo(self)
- }
- }
- impl Tr for S {
- fn foo(&self) -> u32 {
- 1
- }
- }
- }
- fn main() {
- let s = thing::S;
- println!("{:?}", s.foo());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement