Trait synd_api::usecase::Usecase

source ·
pub trait Usecase {
    type Input;
    type Output;
    type Error: Debug;

    // Required methods
    fn new(make: &MakeUsecase) -> Self;
    fn authorize(
        &self,
        principal: Principal,
        input: &Self::Input
    ) -> impl Future<Output = Result<Principal, Unauthorized>>;
    fn usecase(
        &self,
        input: Input<Self::Input>
    ) -> impl Future<Output = Result<Output<Self::Output>, Error<Self::Error>>>;

    // Provided method
    fn audit_operation(&self) -> &'static str { ... }
}

Required Associated Types§

Required Methods§

source

fn new(make: &MakeUsecase) -> Self

source

fn authorize( &self, principal: Principal, input: &Self::Input ) -> impl Future<Output = Result<Principal, Unauthorized>>

Authorize given principal

source

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

Usecase entrypoint

Provided Methods§

source

fn audit_operation(&self) -> &'static str

Object Safety§

This trait is not object safe.

Implementors§