Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct MyLock;
- impl MyLock {
- fn read(&self) -> Foo {
- Foo {}
- }
- }
- struct Foo;
- impl Foo {
- fn val(&self) -> i32 {
- 2
- }
- }
- impl Drop for Foo
- {
- fn drop(&mut self) {
- println!("Dropping Foo!");
- }
- }
- fn main() {
- let l = MyLock {};
- let v = l.read().val();
- println!("v: {}", v);
- }
Add Comment
Please, Sign In to add comment