From a25b1af45690bdd8e1cbb20ee3a5b1c4342de455 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 14 Jun 2024 01:47:39 +0200 Subject: Replace `Command` with a new `Task` API with chain support --- src/multi_window.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/multi_window.rs') diff --git a/src/multi_window.rs b/src/multi_window.rs index b81297dc..4900bb85 100644 --- a/src/multi_window.rs +++ b/src/multi_window.rs @@ -1,6 +1,6 @@ //! Leverage multi-window support in your application. use crate::window; -use crate::{Command, Element, Executor, Settings, Subscription}; +use crate::{Element, Executor, Settings, Subscription, Task}; pub use crate::application::{Appearance, DefaultStyle}; @@ -14,7 +14,7 @@ pub use crate::application::{Appearance, DefaultStyle}; /// document and display only the contents of the `window::Id::MAIN` window. /// /// An [`Application`] can execute asynchronous actions by returning a -/// [`Command`] in some of its methods. +/// [`Task`] in some of its methods. /// /// When using an [`Application`] with the `debug` feature enabled, a debug view /// can be toggled by pressing `F12`. @@ -29,7 +29,7 @@ pub use crate::application::{Appearance, DefaultStyle}; /// /// ```no_run /// use iced::{executor, window}; -/// use iced::{Command, Element, Settings, Theme}; +/// use iced::{Task, Element, Settings, Theme}; /// use iced::multi_window::{self, Application}; /// /// pub fn main() -> iced::Result { @@ -44,16 +44,16 @@ pub use crate::application::{Appearance, DefaultStyle}; /// type Message = (); /// type Theme = Theme; /// -/// fn new(_flags: ()) -> (Hello, Command) { -/// (Hello, Command::none()) +/// fn new(_flags: ()) -> (Hello, Task) { +/// (Hello, Task::none()) /// } /// /// fn title(&self, _window: window::Id) -> String { /// String::from("A cool application") /// } /// -/// fn update(&mut self, _message: Self::Message) -> Command { -/// Command::none() +/// fn update(&mut self, _message: Self::Message) -> Task { +/// Task::none() /// } /// /// fn view(&self, _window: window::Id) -> Element { @@ -89,12 +89,12 @@ where /// /// Here is where you should return the initial state of your app. /// - /// Additionally, you can return a [`Command`] if you need to perform some + /// Additionally, you can return a [`Task`] if you need to perform some /// async action in the background on startup. This is useful if you want to /// load state from a file, perform an initial HTTP request, etc. /// /// [`run`]: Self::run - fn new(flags: Self::Flags) -> (Self, Command); + fn new(flags: Self::Flags) -> (Self, Task); /// Returns the current title of the `window` of the [`Application`]. /// @@ -108,8 +108,8 @@ where /// produced by either user interactions or commands, will be handled by /// this method. /// - /// Any [`Command`] returned will be executed immediately in the background. - fn update(&mut self, message: Self::Message) -> Command; + /// Any [`Task`] returned will be executed immediately in the background. + fn update(&mut self, message: Self::Message) -> Task; /// Returns the widgets to display in the `window` of the [`Application`]. /// @@ -207,7 +207,7 @@ where type Theme = A::Theme; type Renderer = crate::Renderer; - fn update(&mut self, message: Self::Message) -> Command { + fn update(&mut self, message: Self::Message) -> Task { self.0.update(message) } @@ -226,7 +226,7 @@ where { type Flags = A::Flags; - fn new(flags: Self::Flags) -> (Self, Command) { + fn new(flags: Self::Flags) -> (Self, Task) { let (app, command) = A::new(flags); (Instance(app), command) -- cgit