summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-07-14 22:51:52 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-07-14 22:51:52 +0200
commitfd0abe18d0cfde614cc779fa0da71c4e07107b59 (patch)
tree12c028c04b3525244815a1d9f41267253557227e
parentd9a29f51760efc0b2a9d3b0947c15c51897a7a5e (diff)
downloadiced-fd0abe18d0cfde614cc779fa0da71c4e07107b59.tar.gz
iced-fd0abe18d0cfde614cc779fa0da71c4e07107b59.tar.bz2
iced-fd0abe18d0cfde614cc779fa0da71c4e07107b59.zip
Implement `application::Update` for `()`
-rw-r--r--runtime/src/task.rs5
-rw-r--r--src/application.rs10
-rw-r--r--src/lib.rs2
3 files changed, 11 insertions, 6 deletions
diff --git a/runtime/src/task.rs b/runtime/src/task.rs
index 72f408e0..4d75ddaa 100644
--- a/runtime/src/task.rs
+++ b/runtime/src/task.rs
@@ -283,10 +283,7 @@ impl<T, E> Task<Result<T, E>> {
}
}
-impl<T> From<()> for Task<T>
-where
- T: MaybeSend + 'static,
-{
+impl<T> From<()> for Task<T> {
fn from(_value: ()) -> Self {
Self::none()
}
diff --git a/src/application.rs b/src/application.rs
index f5e06471..71cb6a7f 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -417,6 +417,16 @@ pub trait Update<State, Message> {
) -> impl Into<Task<Message>>;
}
+impl<State, Message> Update<State, Message> for () {
+ fn update(
+ &self,
+ _state: &mut State,
+ _message: Message,
+ ) -> impl Into<Task<Message>> {
+ ()
+ }
+}
+
impl<T, State, Message, C> Update<State, Message> for T
where
T: Fn(&mut State, Message) -> C,
diff --git a/src/lib.rs b/src/lib.rs
index 7ced9a57..138f0b04 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -345,8 +345,6 @@ pub type Result = std::result::Result<(), Error>;
///
/// This is equivalent to chaining [`application()`] with [`Application::run`].
///
-/// [`program`]: program()
-///
/// # Example
/// ```no_run
/// use iced::widget::{button, column, text, Column};