pub trait Extension {
type Request: DeserializeOwned + Serialize;
type Reply: DeserializeOwned + Serialize;
// Provided methods
fn serialize_request(
id: u8,
request: &Self::Request,
) -> Result<SerdeExtension, ClientError> { ... }
fn deserialize_request(
request: &SerdeExtension,
) -> Result<Self::Request, Error> { ... }
fn serialize_reply(reply: &Self::Reply) -> Result<SerdeExtension, Error> { ... }
fn deserialize_reply(reply: &SerdeExtension) -> Result<Self::Reply, Error> { ... }
}Expand description
A Trussed API extension.
Required Associated Types§
Sourcetype Request: DeserializeOwned + Serialize
type Request: DeserializeOwned + Serialize
The requests supported by this extension.
Sourcetype Reply: DeserializeOwned + Serialize
type Reply: DeserializeOwned + Serialize
The replies supported by this extension.
Provided Methods§
Sourcefn serialize_request(
id: u8,
request: &Self::Request,
) -> Result<SerdeExtension, ClientError>
fn serialize_request( id: u8, request: &Self::Request, ) -> Result<SerdeExtension, ClientError>
Serialize an extension request.
Requests that are serialized with this function can be deserialized with
Extension::deserialize_request. The format is not guaranteed to be stable over
crate releases.
Sourcefn deserialize_request(request: &SerdeExtension) -> Result<Self::Request, Error>
fn deserialize_request(request: &SerdeExtension) -> Result<Self::Request, Error>
Deserialize an extension request.
This function can be used to deserialize requests that have been serialized with
Extension::serialize_request. The format is not guaranteed to be stable over
crate releases.
Sourcefn serialize_reply(reply: &Self::Reply) -> Result<SerdeExtension, Error>
fn serialize_reply(reply: &Self::Reply) -> Result<SerdeExtension, Error>
Serialize an extension reply.
Replies that are serialized with this function can be deserialized with
Extension::deserialize_reply. The format is not guaranteed to be stable over
crate releases.
Sourcefn deserialize_reply(reply: &SerdeExtension) -> Result<Self::Reply, Error>
fn deserialize_reply(reply: &SerdeExtension) -> Result<Self::Reply, Error>
Deserialize an extension reply.
This function can be used to deserialize replies that have been serialized with
Extension::serialize_reply. The format is not guaranteed to be stable over
crate releases.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".