pub enum Cmd<Msg> {
None,
Batch(Vec<Cmd<Msg>>),
Task(Pin<Box<dyn Future<Output = Msg> + Send + 'static>>),
Msg(Msg),
}Expand description
A command representing a side effect to be executed
Commands are declarative descriptions of side effects. The runtime executes them and feeds resulting messages back into the update loop.
Variants§
None
No side effect
Batch(Vec<Cmd<Msg>>)
Multiple commands to execute
Task(Pin<Box<dyn Future<Output = Msg> + Send + 'static>>)
An async task that produces a message
Msg(Msg)
Emit a message immediately (next frame)
Implementations§
Source§impl<Msg> Cmd<Msg>
impl<Msg> Cmd<Msg>
Source§impl<Msg> Cmd<Msg>
impl<Msg> Cmd<Msg>
Sourcepub fn unwrap_msg(self) -> Msg
pub fn unwrap_msg(self) -> Msg
Source§impl<Msg: Debug> Cmd<Msg>
impl<Msg: Debug> Cmd<Msg>
Sourcepub fn assert_none(&self)
pub fn assert_none(&self)
Assert this is Cmd::None, panics with debug info otherwise
Sourcepub fn assert_task(&self)
pub fn assert_task(&self)
Assert this is Cmd::Task, panics with debug info otherwise
Sourcepub fn assert_msg(&self)
pub fn assert_msg(&self)
Assert this is Cmd::Msg, panics with debug info otherwise
Trait Implementations§
Auto Trait Implementations§
impl<Msg> Freeze for Cmd<Msg>where
Msg: Freeze,
impl<Msg> !RefUnwindSafe for Cmd<Msg>
impl<Msg> Send for Cmd<Msg>where
Msg: Send,
impl<Msg> !Sync for Cmd<Msg>
impl<Msg> Unpin for Cmd<Msg>where
Msg: Unpin,
impl<Msg> UnsafeUnpin for Cmd<Msg>where
Msg: UnsafeUnpin,
impl<Msg> !UnwindSafe for Cmd<Msg>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more