Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created January 24, 2020 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rust-play/a336cd12cba9b06269adfbf29c2b9518 to your computer and use it in GitHub Desktop.
Save rust-play/a336cd12cba9b06269adfbf29c2b9518 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
struct Inner {
a: A,
}
impl Inner {
fn fun(&mut self) {
self.a.something();
}
fn fun2(&mut self, outer: &Arc<Outer>) {
self.a.something2(outer.b);
}
}
struct Outer {
b: B,
inner: Mutex<Inner>,
}
impl Outer {
fn mainfun(self: Arc<Self>) {
let mut inner = self.inner.lock();
// do something with held locks
inner.fun2(&self);
// do something more
}
}
@Moeme123
Copy link

Moeme123 commented Feb 1, 2024

core::alloc

received_1103165434034541.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment