Skip to main content

ServiceObject

Trait ServiceObject 

Source
pub trait ServiceObject:
    Default
    + WithId
    + IdentifiableType {
    // Provided methods
    fn send<'life0, 'life1, 'async_trait, T, V, E>(
        app_data: &'life0 AppData,
        handler_type_id: impl 'async_trait + ToString + Send + Sync,
        handler_id: impl 'async_trait + ToString + Send + Sync,
        payload: &'life1 V,
    ) -> Pin<Box<dyn Future<Output = Result<T, RequestError<E>>> + Send + 'async_trait>>
       where E: Error + DeserializeOwned + Clone + Send + Sync + 'async_trait,
             T: DeserializeOwned + Send + Sync + 'async_trait,
             V: Serialize + IdentifiableType + Send + Sync + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn before_load<'life0, 'async_trait>(
        &'life0 mut self,
        __arg1: Arc<AppData>,
    ) -> Pin<Box<dyn Future<Output = Result<(), ServiceObjectLifeCycleError>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn after_load<'life0, 'async_trait>(
        &'life0 mut self,
        __arg1: Arc<AppData>,
    ) -> Pin<Box<dyn Future<Output = Result<(), ServiceObjectLifeCycleError>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn before_shutdown<'life0, 'async_trait>(
        &'life0 mut self,
        __arg1: Arc<AppData>,
    ) -> Pin<Box<dyn Future<Output = Result<(), ServiceObjectLifeCycleError>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn shutdown<'life0, 'async_trait>(
        &'life0 mut self,
        app_data: Arc<AppData>,
    ) -> Pin<Box<dyn Future<Output = Result<(), ServiceObjectLifeCycleError>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

ServiceObjects are the objects that will respond to various types of messages through the Rio Server

The server stores each ServiceObject onto a registry and control their life cycle

There are a few requirements in oder to implement a ServiceObject: - Default - WithId - IdentifiableType - ObjectStateManager - ServiceObjectStateLoad

Provided Methods§

Source

fn send<'life0, 'life1, 'async_trait, T, V, E>( app_data: &'life0 AppData, handler_type_id: impl 'async_trait + ToString + Send + Sync, handler_id: impl 'async_trait + ToString + Send + Sync, payload: &'life1 V, ) -> Pin<Box<dyn Future<Output = Result<T, RequestError<E>>> + Send + 'async_trait>>
where E: Error + DeserializeOwned + Clone + Send + Sync + 'async_trait, T: DeserializeOwned + Send + Sync + 'async_trait, V: Serialize + IdentifiableType + Send + Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send a message to Rio cluster using a client tht is stored in AppData

Source

fn before_load<'life0, 'async_trait>( &'life0 mut self, __arg1: Arc<AppData>, ) -> Pin<Box<dyn Future<Output = Result<(), ServiceObjectLifeCycleError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source

fn after_load<'life0, 'async_trait>( &'life0 mut self, __arg1: Arc<AppData>, ) -> Pin<Box<dyn Future<Output = Result<(), ServiceObjectLifeCycleError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source

fn before_shutdown<'life0, 'async_trait>( &'life0 mut self, __arg1: Arc<AppData>, ) -> Pin<Box<dyn Future<Output = Result<(), ServiceObjectLifeCycleError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source

fn shutdown<'life0, 'async_trait>( &'life0 mut self, app_data: Arc<AppData>, ) -> Pin<Box<dyn Future<Output = Result<(), ServiceObjectLifeCycleError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

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§