pub trait PersistentFactory<M>: Factory<M>where
M: Send,{
// Required method
fn save<'life0, 'async_trait>(
c: &'life0 Container,
model: M,
) -> Pin<Box<dyn Future<Output = Result<M, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait;
// Provided methods
fn create<'life0, 'async_trait>(
c: &'life0 Container,
) -> Pin<Box<dyn Future<Output = Result<M, Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
fn create_many<'life0, 'async_trait>(
c: &'life0 Container,
count: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<M>, Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Helper for factories that want to persist instances.
Implementing this manually per model lets the factory call into the model’s insert SQL.
Required Methods§
fn save<'life0, 'async_trait>(
c: &'life0 Container,
model: M,
) -> Pin<Box<dyn Future<Output = Result<M, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Provided Methods§
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.