Trait Request

Source
pub trait Request:
    Debug
    + PartialEq
    + Clone {
    type Error: Clone + Debug + PartialEq + 'static;
    type Output: Clone + Debug + PartialEq + 'static;

    // Required method
    fn run<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn store(_: Self::Output) { ... }
}
Expand description

The core request trait which has to be implemented for all handler which can be executed through the use api hook.

Required Associated Types§

Source

type Error: Clone + Debug + PartialEq + 'static

The error which can occur on request failure

Source

type Output: Clone + Debug + PartialEq + 'static

The output type of a succesful request

Required Methods§

Source

fn run<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Run the asynchronous operation responsible for fetching or computing the requested data

Provided Methods§

Source

fn store(_: Self::Output)

Store or otherwise handle the data of a succesful run of the request E.g. Store the requested data in a yewdux store

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.

Implementors§