summaryrefslogtreecommitdiffstats
path: root/examples/toast
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-06-16 20:24:41 +0200
committerLibravatar GitHub <noreply@github.com>2024-06-16 20:24:41 +0200
commit95d4adb55e485c01eec839736f328be26f2ccab6 (patch)
tree2676e3cb8ec17c5bf1cd561d97932ae302551dfd /examples/toast
parente6d0b3bda5042a1017a5944a5227c97e0ed6caf9 (diff)
parentb5c5a016c4f2b608a740b37c494186557a064f48 (diff)
downloadiced-95d4adb55e485c01eec839736f328be26f2ccab6.tar.gz
iced-95d4adb55e485c01eec839736f328be26f2ccab6.tar.bz2
iced-95d4adb55e485c01eec839736f328be26f2ccab6.zip
Merge pull request #2463 from iced-rs/task-api
`Task` API
Diffstat (limited to 'examples/toast')
-rw-r--r--examples/toast/src/main.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/examples/toast/src/main.rs b/examples/toast/src/main.rs
index 700b6b10..aee2479e 100644
--- a/examples/toast/src/main.rs
+++ b/examples/toast/src/main.rs
@@ -4,7 +4,7 @@ use iced::keyboard::key;
use iced::widget::{
self, button, center, column, pick_list, row, slider, text, text_input,
};
-use iced::{Alignment, Command, Element, Length, Subscription};
+use iced::{Alignment, Element, Length, Subscription, Task};
use toast::{Status, Toast};
@@ -49,7 +49,7 @@ impl App {
event::listen().map(Message::Event)
}
- fn update(&mut self, message: Message) -> Command<Message> {
+ fn update(&mut self, message: Message) -> Task<Message> {
match message {
Message::Add => {
if !self.editing.title.is_empty()
@@ -57,27 +57,27 @@ impl App {
{
self.toasts.push(std::mem::take(&mut self.editing));
}
- Command::none()
+ Task::none()
}
Message::Close(index) => {
self.toasts.remove(index);
- Command::none()
+ Task::none()
}
Message::Title(title) => {
self.editing.title = title;
- Command::none()
+ Task::none()
}
Message::Body(body) => {
self.editing.body = body;
- Command::none()
+ Task::none()
}
Message::Status(status) => {
self.editing.status = status;
- Command::none()
+ Task::none()
}
Message::Timeout(timeout) => {
self.timeout_secs = timeout as u64;
- Command::none()
+ Task::none()
}
Message::Event(Event::Keyboard(keyboard::Event::KeyPressed {
key: keyboard::Key::Named(key::Named::Tab),
@@ -88,7 +88,7 @@ impl App {
key: keyboard::Key::Named(key::Named::Tab),
..
})) => widget::focus_next(),
- Message::Event(_) => Command::none(),
+ Message::Event(_) => Task::none(),
}
}
@@ -347,7 +347,7 @@ mod toast {
state: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
- operation: &mut dyn Operation<Message>,
+ operation: &mut dyn Operation<()>,
) {
operation.container(None, layout.bounds(), &mut |operation| {
self.content.as_widget().operate(
@@ -589,7 +589,7 @@ mod toast {
&mut self,
layout: Layout<'_>,
renderer: &Renderer,
- operation: &mut dyn widget::Operation<Message>,
+ operation: &mut dyn widget::Operation<()>,
) {
operation.container(None, layout.bounds(), &mut |operation| {
self.toasts