Implement application::Update for ()
This commit is contained in:
parent
d9a29f5176
commit
fd0abe18d0
3 changed files with 11 additions and 6 deletions
|
|
@ -283,10 +283,7 @@ impl<T, E> Task<Result<T, E>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> From<()> for Task<T>
|
impl<T> From<()> for Task<T> {
|
||||||
where
|
|
||||||
T: MaybeSend + 'static,
|
|
||||||
{
|
|
||||||
fn from(_value: ()) -> Self {
|
fn from(_value: ()) -> Self {
|
||||||
Self::none()
|
Self::none()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -417,6 +417,16 @@ pub trait Update<State, Message> {
|
||||||
) -> impl Into<Task<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
|
impl<T, State, Message, C> Update<State, Message> for T
|
||||||
where
|
where
|
||||||
T: Fn(&mut State, Message) -> C,
|
T: Fn(&mut State, Message) -> C,
|
||||||
|
|
|
||||||
|
|
@ -345,8 +345,6 @@ pub type Result = std::result::Result<(), Error>;
|
||||||
///
|
///
|
||||||
/// This is equivalent to chaining [`application()`] with [`Application::run`].
|
/// This is equivalent to chaining [`application()`] with [`Application::run`].
|
||||||
///
|
///
|
||||||
/// [`program`]: program()
|
|
||||||
///
|
|
||||||
/// # Example
|
/// # Example
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// use iced::widget::{button, column, text, Column};
|
/// use iced::widget::{button, column, text, Column};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue