Struct sauron::dom::Cmd

source ·
pub struct Cmd<MSG> { /* private fields */ }
Expand description

Cmd is a way to tell the Runtime that something needs to be executed

Implementations§

source§

impl<MSG> Cmd<MSG>
where MSG: 'static,

source

pub fn new<F>(f: F) -> Cmd<MSG>
where F: Future<Output = MSG> + 'static,

maps to a once future

source

pub fn once<F>(f: F) -> Cmd<MSG>
where F: Future<Output = MSG> + 'static,

Creates a Cmd which expects to be polled only once

source

pub fn recurring( rx: UnboundedReceiver<MSG>, event_closure: Closure<dyn FnMut(Event)> ) -> Cmd<MSG>

Creates a Cmd which will be polled multiple times

source

pub fn map_msg<F, MSG2>(self, f: F) -> Cmd<MSG2>
where F: Fn(MSG) -> MSG2 + 'static + Clone, MSG2: 'static,

map the msg of this Cmd such that Cmd becomes Cmd.

source

pub fn batch(tasks: impl IntoIterator<Item = Cmd<MSG>>) -> Cmd<MSG>

batch together multiple Cmd into one task

source

pub fn none() -> Cmd<MSG>

Trait Implementations§

source§

impl<APP> From<Cmd<<APP as Application>::MSG>> for Dispatch<APP>
where APP: Application,

source§

fn from(task: Cmd<<APP as Application>::MSG>) -> Dispatch<APP>

Converts to this type from the input type.
source§

impl<MSG, XMSG> From<Cmd<MSG>> for Effects<MSG, XMSG>

source§

fn from(task: Cmd<MSG>) -> Effects<MSG, XMSG>

Converts to this type from the input type.
source§

impl<MSG> From<Effects<MSG, ()>> for Cmd<MSG>
where MSG: 'static,

source§

fn from(effects: Effects<MSG, ()>) -> Cmd<MSG>

Convert Effects that has only follow ups

Auto Trait Implementations§

§

impl<MSG> Freeze for Cmd<MSG>

§

impl<MSG> !RefUnwindSafe for Cmd<MSG>

§

impl<MSG> !Send for Cmd<MSG>

§

impl<MSG> !Sync for Cmd<MSG>

§

impl<MSG> Unpin for Cmd<MSG>

§

impl<MSG> !UnwindSafe for Cmd<MSG>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.