scuffle_bootstrap::global

Trait Global

Source
pub trait Global:
    Send
    + Sync
    + 'static {
    type Config: ConfigParser + Send + 'static;

    // Required method
    fn init(
        config: Self::Config,
    ) -> impl Future<Output = Result<Arc<Self>>> + Send;

    // Provided methods
    fn tokio_runtime() -> Runtime { ... }
    fn pre_init() -> Result<()> { ... }
    fn on_services_start(
        self: &Arc<Self>,
    ) -> impl Future<Output = Result<()>> + Send { ... }
    fn on_exit(
        self: &Arc<Self>,
        result: Result<()>,
    ) -> impl Future<Output = Result<()>> + Send { ... }
    fn on_service_exit(
        self: &Arc<Self>,
        name: &'static str,
        result: Result<()>,
    ) -> impl Future<Output = Result<()>> + Send { ... }
}

Required Associated Types§

Source

type Config: ConfigParser + Send + 'static

Required Methods§

Source

fn init(config: Self::Config) -> impl Future<Output = Result<Arc<Self>>> + Send

Initialize the global.

Provided Methods§

Source

fn tokio_runtime() -> Runtime

Builds the tokio runtime for the application.

Source

fn pre_init() -> Result<()>

Called before loading the config.

Source

fn on_services_start( self: &Arc<Self>, ) -> impl Future<Output = Result<()>> + Send

Called when all services have been started.

Source

fn on_exit( self: &Arc<Self>, result: Result<()>, ) -> impl Future<Output = Result<()>> + Send

Called when the shutdown process is complete, right before exiting the process.

Source

fn on_service_exit( self: &Arc<Self>, name: &'static str, result: Result<()>, ) -> impl Future<Output = Result<()>> + Send

Called when a service exits.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§