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§
Sourcefn lookup_object(&self, id: &ObjectId) -> Result<Arc<dyn Object>, LookupError>
fn lookup_object(&self, id: &ObjectId) -> Result<Arc<dyn Object>, LookupError>
Look up an object by identity within this context.
Sourcefn register_owned(&self, object: Arc<dyn Object>) -> ObjectId
fn register_owned(&self, object: Arc<dyn Object>) -> ObjectId
Create an owning reference to object
within this context.
Return an ObjectId for this object.
Sourcefn release_owned(&self, object: &ObjectId) -> Result<(), LookupError>
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.
Sourcefn dispatch_table(&self) -> &Arc<RwLock<DispatchTable>>
fn dispatch_table(&self) -> &Arc<RwLock<DispatchTable>>
Return a dispatch table that can be used to invoke other RPC methods.