Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. #[derive(Debug)]
  2. struct Foo {}
  3.  
  4. #[derive(Debug)]
  5. struct Bar<'a>(&'a Foo);
  6.  
  7. impl<'a> Bar<'a> {
  8. pub fn new(x: &'a Foo) -> Self { Bar(x) }
  9. pub fn new2() -> Self { Bar(&Foo{}) }
  10. }
  11.  
  12.  
  13. fn main() {
  14. let x = Bar::new2();
  15. println!("x = {:?}", &x);
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement