Skip to main content

Lifecycle

Trait Lifecycle 

Source
pub trait Lifecycle:
    Sized
    + Send
    + 'static {
    type Config: DeserializeOwned + Default + Send + 'static;
    type Error: Error + Send + Sync + 'static;
    type Context: Context;

    // Required methods
    fn prepare(
        config: Self::Config,
        setup: &mut Setup<Self>,
    ) -> impl Future<Output = Result<Self, Self::Error>> + Send;
    fn initialize(
        &mut self,
        context: &Self::Context,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
    fn stop(
        &mut self,
        context: &Self::Context,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
    fn cleanup(
        &mut self,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
}

Required Associated Types§

Required Methods§

Source

fn prepare( config: Self::Config, setup: &mut Setup<Self>, ) -> impl Future<Output = Result<Self, Self::Error>> + Send

Source

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

Source

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

Source

fn cleanup(&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§