Skip to main content

Factory

Trait Factory 

Source
pub trait Factory: Send + Sync {
    type Model;

    // Required methods
    fn make(&self) -> Self::Model;
    fn create<'life0, 'life1, 'async_trait>(
        &'life0 self,
        pool: &'life1 PgPool,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Model, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Associated Types§

Required Methods§

Source

fn make(&self) -> Self::Model

Build an in-memory instance without persisting.

Source

fn create<'life0, 'life1, 'async_trait>( &'life0 self, pool: &'life1 PgPool, ) -> Pin<Box<dyn Future<Output = Result<Self::Model, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Persist an instance.

Implementors§