[][src]Trait tari_service_framework::ServiceInitializer

pub trait ServiceInitializer {
    type Future: Future<Output = Result<(), ServiceInitializationError>>;
    fn initialize(&mut self, context: ServiceInitializerContext) -> Self::Future;

    fn boxed(self) -> BoxedServiceInitializer
    where
        Self: Sized + Send + 'static,
        Self::Future: Send + 'static
, { ... } }

Implementors of this trait will initialize a service The StackBuilder builds impls of this trait.

Associated Types

type Future: Future<Output = Result<(), ServiceInitializationError>>[src]

The future returned from the initialize function

Loading content...

Required methods

fn initialize(&mut self, context: ServiceInitializerContext) -> Self::Future[src]

Async initialization code for a service

Loading content...

Provided methods

fn boxed(self) -> BoxedServiceInitializer where
    Self: Sized + Send + 'static,
    Self::Future: Send + 'static, 
[src]

Create a boxed version of this ServiceInitializer.

Loading content...

Implementors

impl<T: Send + Sync + 'static> ServiceInitializer for RegisterHandle<T>[src]

impl<TFunc, TFut> ServiceInitializer for TFunc where
    TFunc: FnMut(ServiceInitializerContext) -> TFut,
    TFut: Future<Output = Result<(), ServiceInitializationError>>, 
[src]

Implementation of ServiceInitializer for any function matching the signature of ServiceInitializer::initialize This allows the following "short-hand" syntax to be used:

let my_initializer = |executor: runtime::Handle, context: ServiceInitializerContext| {
    // initialization code
    futures::future::ready(Result::<_, ()>::Ok(()))
};

type Future = TFut

Loading content...