Trait Moment

Source
pub trait Moment:
    Send
    + Sync
    + Sized
    + Clone {
    type Value: Moment;

    // Required method
    fn resolve<'async_trait>(
        self,
    ) -> Pin<Box<dyn Future<Output = Self::Value> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

A unit of work that can be resolved into a value.

Any type that implements Moment can be stacked with other Moments to create a calculation. The calculation can be resolved in parallel, even when the Moments depend on the output of each other.

Required Associated Types§

Source

type Value: Moment

The type of value that this Moment resolves to.

It must be thread friendly and sized.

Required Methods§

Source

fn resolve<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Self::Value> + Send + 'async_trait>>
where Self: 'async_trait,

Resolve this Moment into its value.

This will resolve any dependencies of this Moment and then resolve this Moment into its value. If this Moment has no dependencies, it will resolve immediately.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Moment for bool

Source§

type Value = bool

Source§

fn resolve<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Self::Value> + Send + 'async_trait>>
where Self: 'async_trait,

Source§

impl Moment for char

Source§

type Value = char

Source§

fn resolve<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Self::Value> + Send + 'async_trait>>
where Self: 'async_trait,

Source§

impl Moment for f32

Source§

type Value = f32

Source§

fn resolve<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Self::Value> + Send + 'async_trait>>
where Self: 'async_trait,

Source§

impl Moment for f64

Source§

type Value = f64

Source§

fn resolve<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Self::Value> + Send + 'async_trait>>
where Self: 'async_trait,

Source§

impl Moment for i8

Source§

type Value = i8

Source§

fn resolve<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Self::Value> + Send + 'async_trait>>
where Self: 'async_trait,

Source§

impl Moment for i16

Source§

type Value = i16

Source§

fn resolve<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Self::Value> + Send + 'async_trait>>
where Self: 'async_trait,

Source§

impl Moment for i32

Source§

type Value = i32

Source§

fn resolve<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Self::Value> + Send + 'async_trait>>
where Self: 'async_trait,

Source§

impl Moment for i64

Source§

type Value = i64

Source§

fn resolve<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Self::Value> + Send + 'async_trait>>
where Self: 'async_trait,

Source§

impl Moment for i128

Source§

type Value = i128

Source§

fn resolve<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Self::Value> + Send + 'async_trait>>
where Self: 'async_trait,

Source§

impl Moment for isize

Source§

type Value = isize

Source§

fn resolve<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Self::Value> + Send + 'async_trait>>
where Self: 'async_trait,

Source§

impl Moment for u8

Source§

type Value = u8

Source§

fn resolve<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Self::Value> + Send + 'async_trait>>
where Self: 'async_trait,

Source§

impl Moment for u16

Source§

type Value = u16

Source§

fn resolve<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Self::Value> + Send + 'async_trait>>
where Self: 'async_trait,

Source§

impl Moment for u32

Source§

type Value = u32

Source§

fn resolve<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Self::Value> + Send + 'async_trait>>
where Self: 'async_trait,

Source§

impl Moment for u64

Source§

type Value = u64

Source§

fn resolve<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Self::Value> + Send + 'async_trait>>
where Self: 'async_trait,

Source§

impl Moment for u128

Source§

type Value = u128

Source§

fn resolve<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Self::Value> + Send + 'async_trait>>
where Self: 'async_trait,

Source§

impl Moment for usize

Source§

type Value = usize

Source§

fn resolve<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Self::Value> + Send + 'async_trait>>
where Self: 'async_trait,

Source§

impl<T> Moment for Option<T>
where T: Moment,

Source§

type Value = Option<<T as Moment>::Value>

Source§

fn resolve<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Self::Value> + Send + 'async_trait>>
where Self: 'async_trait,

Source§

impl<T, E> Moment for Result<T, E>
where T: Moment, E: Error + Send + Sync + Clone + 'static,

Source§

type Value = Result<<T as Moment>::Value, E>

Source§

fn resolve<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Self::Value> + Send + 'async_trait>>
where Self: 'async_trait,

Implementors§

Source§

impl<A, B, O> Moment for Add<A, B, O>
where A: Moment, B: Moment, O: Moment, A::Value: Add<B::Value, Output = O>,

Source§

type Value = O

Source§

impl<A, B, O> Moment for Div<A, B, O>
where A: Moment, B: Moment, O: Moment, A::Value: Div<B::Value, Output = O>,

Source§

type Value = O

Source§

impl<A, B, O> Moment for Mul<A, B, O>
where A: Moment, B: Moment, O: Moment, A::Value: Mul<B::Value, Output = O>,

Source§

type Value = O

Source§

impl<A, B, O> Moment for Rem<A, B, O>
where A: Moment, B: Moment, O: Moment, A::Value: Rem<B::Value, Output = O>,

Source§

type Value = O

Source§

impl<A, B, O> Moment for Sub<A, B, O>
where A: Moment, B: Moment, O: Moment, A::Value: Sub<B::Value, Output = O>,

Source§

type Value = O

Source§

impl<C, T, F> Moment for If<C, T, F>
where C: Moment<Value = bool>, T: Moment, F: Moment,

Source§

type Value = If<C, <T as Moment>::Value, <F as Moment>::Value>

Source§

impl<I, O> Moment for Convert<I, O>
where I: Moment, O: Moment, I::Value: Into<O>,

Source§

type Value = O

Source§

impl<I, O> Moment for TryConvert<I, O>
where I: Moment, O: Moment, I::Value: TryInto<O>, <I::Value as TryInto<O>>::Error: Error + Send + Sync + Clone + 'static,

Source§

type Value = Result<O, <<I as Moment>::Value as TryInto<O>>::Error>

Source§

impl<T> Moment for Value<T>
where T: Moment,