Skip to main content

Resident

Trait Resident 

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

    // Required methods
    fn run(
        &mut self,
        context: ServiceContext<A>,
    ) -> impl Future<Output = Result<(), 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: Error + Send + Sync + 'static

Required Methods§

Source

fn run( &mut self, context: ServiceContext<A>, ) -> impl Future<Output = Result<(), 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(ServiceContext<A>) -> Fut + Send + 'static, Fut: Future<Output = Result<(), E>> + Send + 'static, E: Error + Send + Sync + 'static,

Source§

type Error = E