pub trait SharedObject: Send + Sync {
// Required method
fn call<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
method: &'life1 str,
args: &'life2 Value,
) -> Pin<Box<dyn Future<Output = Value> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
Trait for an object that can be exposed to the RPC worker.
A SharedObject defines how a given object responds to remote
procedure calls. Each object must implement a single method:
call: Handles a method call with JSON arguments and returns a JSON value as a result.
Objects must be thread-safe (Send + Sync) since they may be shared
across async tasks.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".