the.bay.news

Help figuring out where drop is called in this case

The Rust Programming Language Forum
Help figuring out where drop is called in this case
Why does calling get_or_init cause a deadlock? #[derive(Clone)] struct A(i32); impl A {fn incremented(&self) -> i32 {self.0 + 1}} struct M {field: RwLock<Option<A>>} impl M { fn get_or_init(&self) -> i32 { //let my_a = self.field.read().unwrap().clone(); //my_a.map_or_else( { self.field.read().unwrap().clone() }.map_or_else( || { let mut field = self.field.write().unwrap(); *field = Some(A(10)); A(10).incr...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.