mesh_rpc::service

Trait ServiceRpc

Source
pub trait ServiceRpc:
    'static
    + Send
    + Sized {
    const NAME: &'static str;

    // Required methods
    fn method(&self) -> &'static str;
    fn encode(self, writer: FieldWriter<'_, '_, Resource>) -> Port;
    fn compute_size(&mut self, sizer: FieldSizer<'_>);
    fn decode(
        method: &str,
        port: Port,
        data: &[u8],
    ) -> Result<Self, (ServiceRpcError, Port)>;
}
Expand description

Trait for service-specific RPC requests.

Required Associated Constants§

Source

const NAME: &'static str

The service name.

Required Methods§

Source

fn method(&self) -> &'static str

The method name.

Source

fn encode(self, writer: FieldWriter<'_, '_, Resource>) -> Port

Encode the request into a field.

Source

fn compute_size(&mut self, sizer: FieldSizer<'_>)

Compute the field size of the request.

Source

fn decode( method: &str, port: Port, data: &[u8], ) -> Result<Self, (ServiceRpcError, Port)>

Decode the request from a field.

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.

Implementors§