I'm trying to update a struct that is enclosed in an ArcSwap
and Arc
: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=9a80238ee30a62e57a3640619f4044d1
However, I am getting an error for the following function:
fn internal_bug_grower(bug: &mut Arc<ArcSwap<Bug>>) {
let mut new_bug = bug.clone().load();
new_bug.grow_bug();
bug.store(Arc::new(new_bug)); // this fails
}
I have tried several ways of doing this such as removing the Arc
(bug.store(new_bug)
), dereferencing the guard (bug.store(*new_bug)
), cloning etc, but I cannot get it to work.