Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct A;
- trait T {
- fn f(&self);
- fn g(self);
- }
- impl T for A {
- fn f(&self) {
- println!("T::f()");
- }
- fn g(self) {
- println!("T::g()");
- }
- }
- impl T for &A {
- fn f(&self) {
- println!("(&T)::f()");
- }
- fn g(self) {
- println!("(&T)::g()");
- }
- }
- fn main() {
- let a1 = A;
- a1.f();
- a1.g();
- let a2 = &A;
- a2.f();
- a2.g();
- let a3 = &&A;
- a3.f();
- a3.g();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement