RpcMethodPrebuffered

Trait RpcMethodPrebuffered 

Source
pub trait RpcMethodPrebuffered {
    type Input;
    type Output;

    const METHOD_ID: u64;

    // Required methods
    fn encode_request(input: Self::Input) -> Result<Vec<u8>, Error>;
    fn decode_request(request_bytes: &[u8]) -> Result<Self::Input, Error>;
    fn encode_response(output: Self::Output) -> Result<Vec<u8>, Error>;
    fn decode_response(response_bytes: &[u8]) -> Result<Self::Output, Error>;
}

Required Associated Constants§

Source

const METHOD_ID: u64

A unique identifier for the RPC method.

Required Associated Types§

Source

type Input

The high-level input type expected by the request encoder (e.g., Vec<f64>).

Source

type Output

The high-level output type returned from the response encoder (e.g., f64).

Required Methods§

Source

fn encode_request(input: Self::Input) -> Result<Vec<u8>, Error>

Encodes the request into a byte array.

Source

fn decode_request(request_bytes: &[u8]) -> Result<Self::Input, Error>

Decodes raw request bytes into a typed request struct.

§Arguments
  • bytes - Serialized request payload.
Source

fn encode_response(output: Self::Output) -> Result<Vec<u8>, Error>

Encodes the response value into a byte array.

Source

fn decode_response(response_bytes: &[u8]) -> Result<Self::Output, Error>

Decodes raw response bytes into a typed response struct or value.

§Arguments
  • bytes - Serialized response payload.

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§

Source§

impl RpcMethodPrebuffered for Add

Source§

const METHOD_ID: u64 = 7_807_177_800_772_943_291u64

Source§

type Input = Vec<f64>

Source§

type Output = f64

Source§

impl RpcMethodPrebuffered for Echo

Source§

const METHOD_ID: u64 = 10_473_306_011_986_378_567u64

Source§

type Input = Vec<u8>

Source§

type Output = Vec<u8>

Source§

impl RpcMethodPrebuffered for Mult

Source§

const METHOD_ID: u64 = 10_373_491_490_581_128_508u64

Source§

type Input = Vec<f64>

Source§

type Output = f64