CapabilityProvider

Trait CapabilityProvider 

Source
pub trait CapabilityProvider:
    CloneProvider
    + Send
    + Sync {
    // Required methods
    fn configure_dispatch(
        &self,
        dispatcher: Box<dyn Dispatcher>,
    ) -> Result<(), Box<dyn Error + Send + Sync>>;
    fn handle_call(
        &self,
        actor: &str,
        op: &str,
        msg: &[u8],
    ) -> Result<Vec<u8>, Box<dyn Error + Send + Sync>>;
    fn stop(&self);
}
Expand description

Every native capability provider must implement this trait. Both portable and native capability providers must respond to the following operations: OP_BIND_ACTOR, OP_REMOVE_ACTOR, OP_GET_CAPABILITY_DESCRIPTOR

Required Methods§

Source

fn configure_dispatch( &self, dispatcher: Box<dyn Dispatcher>, ) -> Result<(), Box<dyn Error + Send + Sync>>

This function will be called on the provider when the host runtime is ready and has configured a dispatcher. This function is only ever called once for a capability provider, regardless of the number of actors being managed in the host

Source

fn handle_call( &self, actor: &str, op: &str, msg: &[u8], ) -> Result<Vec<u8>, Box<dyn Error + Send + Sync>>

Invoked when an actor has requested that a provider perform a given operation

Source

fn stop(&self)

This function is called to let the capability provider know that it is being removed from the host runtime. This gives the provider an opportunity to clean up any resources and stop any running threads

Trait Implementations§

Source§

impl Clone for Box<dyn CapabilityProvider>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Implementors§