Trait Generator

Source
pub trait Generator: Send + Sync {
    type Item;

    // Required method
    fn generate<'life0, 'life1, 'async_trait>(
        &'life0 self,
        input: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Vec<Self::Item>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Generator is a kind of Source but it takes input. It is not envisaged that Generator will return a large number of items.

Generator can be used to implement a calculator (that needs a user input).

Required Associated Types§

Required Methods§

Source

fn generate<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 str, ) -> Pin<Box<dyn Future<Output = Vec<Self::Item>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§

Source§

impl<Item, F> Generator for ClosureGenerator<Item, F>
where F: Fn(&str) -> Vec<Item> + Sync + Send, Item: Sync + Send,

Source§

type Item = Item

Source§

impl<Item, GenT, F, Cushion> Generator for GenWrapper<Item, GenT, F, Cushion>
where F: Fn(Item) -> Cushion + Sync + Send, GenT: Generator<Item = Item> + Sync, Cushion: Sync + Send,

Source§

type Item = Cushion