refactor: allow resetting main window id to None
This commit is contained in:
parent
953685a882
commit
07763aca8e
4 changed files with 17 additions and 27 deletions
|
|
@ -372,12 +372,14 @@ impl Core {
|
|||
}
|
||||
|
||||
/// The [`Id`] of the main window
|
||||
#[must_use]
|
||||
pub fn main_window_id(&self) -> Option<window::Id> {
|
||||
self.main_window.filter(|id| iced::window::Id::NONE != *id)
|
||||
}
|
||||
|
||||
/// Reset the tracked main window to a new value
|
||||
pub fn set_main_window_id(&mut self, id: window::Id) -> Option<window::Id> {
|
||||
self.main_window.replace(id)
|
||||
pub fn set_main_window_id(&mut self, mut id: Option<window::Id>) -> Option<window::Id> {
|
||||
std::mem::swap(&mut self.main_window, &mut id);
|
||||
id
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue