I know how to take ownership out of a Box
:
let unique = Box::new(Foo {});
let foo = *unique;
And I know how to get a mutable reference from an Arc
:
let mut shared = Arc::new(Foo{});
let foo = Arc::get_mut(&mut shared).unwrap();
But can I take the ownership out of an Arc
?
1 Like
H2CO3
2
A quick docs search reveals try_unwrap()
.
5 Likes
Thanks, I tried some keywords like take
, or own
, didn't expect it to be unwrap
.
system
Closed
4
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.