Skip to main content

UseCase

Trait UseCase 

Source
pub trait UseCase:
    Send
    + Sync
    + Send {
    type Input: Send;
    type Output: Send;
    type Error: Error + Send + Sync + 'static;

    // Required method
    fn execute(
        &self,
        input: Self::Input,
    ) -> impl Future<Output = Result<Self::Output, Self::Error>> + Send;
}
Expand description

A single, named application operation that orchestrates domain objects and ports to do one thing.

Required Associated Types§

Source

type Input: Send

The input required to run this use case.

Source

type Output: Send

What this use case produces on success.

Source

type Error: Error + Send + Sync + 'static

What this use case produces on failure.

Required Methods§

Source

fn execute( &self, input: Self::Input, ) -> impl Future<Output = Result<Self::Output, Self::Error>> + Send

Runs the use case.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§