• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 pub struct Something { pub x: isize }
2 
3 pub trait A {
f(&self) -> isize4     fn f(&self) -> isize;
g(&self) -> isize5     fn g(&self) -> isize { 10 }
h(&self) -> isize6     fn h(&self) -> isize { 11 }
lurr(x: &Self, y: &Self) -> isize7     fn lurr(x: &Self, y: &Self) -> isize { x.g() + y.h() }
8 }
9 
10 
11 impl A for isize {
f(&self) -> isize12     fn f(&self) -> isize { 10 }
13 }
14 
15 impl A for Something {
f(&self) -> isize16     fn f(&self) -> isize { 10 }
17 }
18 
19 pub trait B<T> {
thing<U>(&self, x: T, y: U) -> (T, U)20     fn thing<U>(&self, x: T, y: U) -> (T, U) { (x, y) }
staticthing<U>(_z: &Self, x: T, y: U) -> (T, U)21     fn staticthing<U>(_z: &Self, x: T, y: U) -> (T, U) { (x, y) }
22 }
23 
24 impl<T> B<T> for isize { }
25 impl B<f64> for bool { }
26 
27 
28 
29 pub trait TestEquality {
test_eq(&self, rhs: &Self) -> bool30     fn test_eq(&self, rhs: &Self) -> bool;
test_neq(&self, rhs: &Self) -> bool31     fn test_neq(&self, rhs: &Self) -> bool {
32         !self.test_eq(rhs)
33     }
34 }
35 
36 impl TestEquality for isize {
test_eq(&self, rhs: &isize) -> bool37     fn test_eq(&self, rhs: &isize) -> bool {
38         *self == *rhs
39     }
40 }
41