Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide into_inner() for egui::mutex::{Mutex, RwLock} #3030

Closed
KmolYuan opened this issue May 27, 2023 · 0 comments · Fixed by #3110
Closed

Provide into_inner() for egui::mutex::{Mutex, RwLock} #3030

KmolYuan opened this issue May 27, 2023 · 0 comments · Fixed by #3110

Comments

@KmolYuan
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Currently, there's no into_inner() method for two lock types egui::mutex::{Mutex, RwLock}.
So the inner value T cannot move out from the wrapper.

/* struct App { */
finish_list: Vec<T>, // Access T without locks
#[serde(skip)]
queue: Vec<Arc<RwLock<T>>>, // Move values to `finish_list` if parallel jobs are done
                            // Also showing some progress bars in GUI

Describe the solution you'd like

Provide fn into_inner(self) -> T through lock_api and atomic_refcell.

Describe alternatives you've considered

  • Make the inner value T: Clone, then clone it out.
  • Implement serialization (serde) for these locks? It's helpful to save sharable data in the app state.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant