pub trait JsonRpcParams{
type Container<T>: Debug + Serialize;
type Response: Debug + DeserializeOwned;
// Required method
fn build(self, id: JsonRpcId) -> JsonRpcRequest<Self>;
}Expand description
Implemented by Odoo “method” types (e.g.,
Execute or
SessionAuthenticate)
When building an JsonRpcRequest object, the params field is actually
set to JsonRpcParams::Container, not the concrete “method” type. This
allows for flexibility in the Serialize impl.
For example, the Execute method uses OdooApiContainer as its container,
which injects the service and method keys into the request struct:
{
"jsonrpc": "2.0",
"method": "call",
"id": 1000,
"params": {
"service": "object",
"method": "execute",
"args": <Execute is serialized here>
}
}Whereas the SessionAuthenticate method’s container (OdooWebContainer)
has a transparent Serialize impl, so the SessionAuthenticate data is set
directly on the params key:
{
"jsonrpc": "2.0",
"method": "call",
"id": 1000,
"params": <SessionAuthenticate is serialized here>
}Required Associated Types§
Required Methods§
fn build(self, id: JsonRpcId) -> JsonRpcRequest<Self>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.