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