Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. trait Test<'a> {
  2. fn get<'b: 'a>(&'b self) -> &'a i32;
  3. }
  4.  
  5. struct TestStruct<'a> {
  6. t: Test<'a>,
  7. }
  8.  
  9. struct Foo(i32);
  10. impl<'a> Test<'a> for Foo {
  11. fn get<'b: 'a>(&'b self) -> &'a i32 {
  12. return &self.0;
  13. }
  14. }
  15.  
  16. fn main() {
  17. let ts = TestStruct {t: Foo(0)};
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement