Skip to main content

UseCaseService

Trait UseCaseService 

Source
pub trait UseCaseService<E: Send + Sync + 'static>: Send + Sync {
    // Required methods
    fn find_by_id<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = UseCaseResult<Option<E>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn persist<'life0, 'async_trait>(
        &'life0 self,
        entity: E,
    ) -> Pin<Box<dyn Future<Output = UseCaseResult<E>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn remove<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = UseCaseResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

The minimal persistence + lookup contract required by all use cases.

GenericCrudService from service.rs implements this, as will any custom service that wraps it.

Required Methods§

Source

fn find_by_id<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = UseCaseResult<Option<E>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn persist<'life0, 'async_trait>( &'life0 self, entity: E, ) -> Pin<Box<dyn Future<Output = UseCaseResult<E>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn remove<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = UseCaseResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§