Skip to main content

Resident

Trait Resident 

Source
pub trait Resident<A: Application>: Send + 'static {
    type Error: Debug + Display + Send + Sync + 'static;

    // Required methods
    fn run(
        &mut self,
        context: Service<A>,
    ) -> impl Future<Output = Result<(), Fault<Self::Error>>> + Send;
    fn cleanup(
        &mut self,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;

    // Provided method
    fn stop(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send { ... }
}

Required Associated Types§

Source

type Error: Debug + Display + Send + Sync + 'static

Required Methods§

Source

fn run( &mut self, context: Service<A>, ) -> impl Future<Output = Result<(), Fault<Self::Error>>> + Send

Source

fn cleanup(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send

Provided Methods§

Source

fn stop(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<A, F, Fut, E> Resident<A> for F
where A: Application, F: FnMut(Service<A>) -> Fut + Send + 'static, Fut: Future<Output = Result<(), Fault<E>>> + Send + 'static, E: Debug + Display + Send + Sync + 'static,

Source§

type Error = E