Skip to main content

Context

Trait Context 

Source
pub trait Context: Send + Sync {
    // Required methods
    fn lookup_object(
        &self,
        id: &ObjectId,
    ) -> Result<Arc<dyn Object>, LookupError>;
    fn register_owned(&self, object: Arc<dyn Object>) -> ObjectId;
    fn register_weak(&self, object: &Arc<dyn Object>) -> ObjectId;
    fn release(&self, object: &ObjectId) -> Result<(), LookupError>;
    fn dispatch_table(&self) -> &Arc<RwLock<DispatchTable>>;
}
Expand description

A trait describing the context in which an RPC method is executed.

Required Methods§

Source

fn lookup_object(&self, id: &ObjectId) -> Result<Arc<dyn Object>, LookupError>

Look up an object by identity within this context.

Source

fn register_owned(&self, object: Arc<dyn Object>) -> ObjectId

Create an owning reference to object within this context.

Return an ObjectId for this object.

Source

fn register_weak(&self, object: &Arc<dyn Object>) -> ObjectId

Create a non-owning weak referene to object within this context.

Return an ObjectId for this object.

Source

fn release(&self, object: &ObjectId) -> Result<(), LookupError>

Drop a reference to the object called object within this context.

This will return an error if object does not exist.

Source

fn dispatch_table(&self) -> &Arc<RwLock<DispatchTable>>

Return a dispatch table that can be used to invoke other RPC methods.

Implementors§