scuffle_bootstrap::service

Trait Service

Source
pub trait Service<Global>:
    Send
    + Sync
    + 'static
    + Sized {
    // Provided methods
    fn name(&self) -> Option<&'static str> { ... }
    fn enabled(
        &self,
        global: &Arc<Global>,
    ) -> impl Future<Output = Result<bool>> + Send { ... }
    fn run(
        self,
        global: Arc<Global>,
        ctx: Context,
    ) -> impl Future<Output = Result<()>> + Send + 'static { ... }
}

Provided Methods§

Source

fn name(&self) -> Option<&'static str>

Source

fn enabled( &self, global: &Arc<Global>, ) -> impl Future<Output = Result<bool>> + Send

Initialize the service

Source

fn run( self, global: Arc<Global>, ctx: Context, ) -> impl Future<Output = Result<()>> + Send + 'static

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§

Source§

impl<G, F, Fut> Service<G> for F
where F: FnOnce(Arc<G>, Context) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,