Created
December 16, 2021 02:06
-
-
Save espindola/4e3bccb61657c0f2ba388eeb8e25f3dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::ops::DerefMut; | |
struct Foo { | |
a: i32, | |
b: bool, | |
} | |
fn foo(_: &mut i32, _: bool) {} | |
fn main() { | |
let f = Foo { a: 42, b: true }; | |
let mut zed = std::boxed::Box::new(f); | |
let xyz = &mut zed.deref_mut().a; | |
//let xyz = &mut zed.a; | |
foo(xyz, zed.b); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment