Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Something(i32);
- impl Something {
- fn new() -> Something {
- Something(42)
- }
- fn do_something(&self) -> &i32 {
- &self.0
- }
- }
- fn main() {
- let x;
- {
- let s = Something::new();
- x = s.do_something();
- }
- println!("{}", x);
- }
Add Comment
Please, Sign In to add comment