Make window::open pure again

This commit is contained in:
Héctor Ramón Jiménez 2025-07-08 00:31:04 +02:00
parent 98d8f466bb
commit 1deb87694d
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
3 changed files with 12 additions and 19 deletions

View file

@ -18,7 +18,7 @@ use raw_window_handle::WindowHandle;
#[allow(missing_debug_implementations)]
pub enum Action {
/// Opens a new window with some [`Settings`].
Open(Id, Settings, oneshot::Sender<Id>),
Open(Settings, oneshot::Sender<Id>),
/// Close the window and exits the application.
Close(Id),
@ -249,15 +249,10 @@ pub fn close_requests() -> Subscription<Id> {
/// Opens a new window with the given [`Settings`]; producing the [`Id`]
/// of the new window on completion.
pub fn open(settings: Settings) -> (Id, Task<Id>) {
let id = Id::unique();
(
id,
task::oneshot(|channel| {
crate::Action::Window(Action::Open(id, settings, channel))
}),
)
pub fn open(settings: Settings) -> Task<Id> {
task::oneshot(|channel| {
crate::Action::Window(Action::Open(settings, channel))
})
}
/// Closes the window with `id`.