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 release_owned(&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 release_owned(&self, object: &ObjectId) -> Result<(), LookupError>

Drop an owning reference to the object called object within this context.

This will return an error if object is not an owning reference, or 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§