Trait capitan_lib::services::prelude::SharedService[][src]

pub trait SharedService: Any {
    #[must_use]
    fn init<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Res<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn main<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Res<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn repeat<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Res<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn catch<'life0, 'async_trait>(
        &'life0 self,
        error: Error
    ) -> Pin<Box<dyn Future<Output = Res<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn abort<'life0, 'async_trait>(
        &'life0 self,
        error: Error
    ) -> Pin<Box<dyn Future<Output = Res<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn to_dyn(self) -> (DynamicSharedService, Weak<Self>)
    where
        Self: Sized + Sync + Send
, { ... } }

Services with a reference to self. Can be shared among threads. Useful for monitoring services and others.

Required methods

#[must_use]
fn init<'life0, 'async_trait>(
    &'life0 self
) -> Pin<Box<dyn Future<Output = Res<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

only runs once at the start

#[must_use]
fn main<'life0, 'async_trait>(
    &'life0 self
) -> Pin<Box<dyn Future<Output = Res<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

loops

#[must_use]
fn repeat<'life0, 'async_trait>(
    &'life0 self
) -> Pin<Box<dyn Future<Output = Res<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

runs after main if main or repeat did not return errors

#[must_use]
fn catch<'life0, 'async_trait>(
    &'life0 self,
    error: Error
) -> Pin<Box<dyn Future<Output = Res<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

runs after main if main returned an error

#[must_use]
fn abort<'life0, 'async_trait>(
    &'life0 self,
    error: Error
) -> Pin<Box<dyn Future<Output = Res<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

run if catch was not successful

Loading content...

Provided methods

fn to_dyn(self) -> (DynamicSharedService, Weak<Self>) where
    Self: Sized + Sync + Send
[src]

Loading content...

Implementors

impl SharedService for DynamicSharedService[src]

Loading content...