Advertisement
Guest User

Untitled

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