Draft widget operations
This commit is contained in:
parent
a003e797e8
commit
80688689aa
16 changed files with 395 additions and 55 deletions
|
|
@ -3,6 +3,8 @@ mod action;
|
|||
|
||||
pub use action::Action;
|
||||
|
||||
use crate::widget;
|
||||
|
||||
use iced_futures::MaybeSend;
|
||||
|
||||
use std::fmt;
|
||||
|
|
@ -24,6 +26,13 @@ impl<T> Command<T> {
|
|||
Self(iced_futures::Command::single(action))
|
||||
}
|
||||
|
||||
/// Creates a [`Command`] that performs a [`widget::Operation`].
|
||||
pub fn widget(operation: impl widget::Operation<T> + 'static) -> Self {
|
||||
Self(iced_futures::Command::single(Action::Widget(
|
||||
widget::Action::new(operation),
|
||||
)))
|
||||
}
|
||||
|
||||
/// Creates a [`Command`] that performs the action of the given future.
|
||||
pub fn perform<A>(
|
||||
future: impl Future<Output = T> + 'static + MaybeSend,
|
||||
|
|
@ -51,6 +60,7 @@ impl<T> Command<T> {
|
|||
) -> Command<A>
|
||||
where
|
||||
T: 'static,
|
||||
A: 'static,
|
||||
{
|
||||
let Command(command) = self;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue