Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[derive(Debug)]
- struct Foo<'a> {
- a: u32,
- b: &'a u32,
- }
- impl<'a> Foo<'a> {
- fn new() -> Self {
- let a = 123;
- Foo { a, b: &a }
- }
- }
- fn main() {
- let foo = Foo::new();
- println!("{}", foo.b);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement