[][src]Trait essrpc::ServerTransport

pub trait ServerTransport {
    type RXState;
    fn rx_begin_call(
        &mut self
    ) -> Result<(PartialMethodId, Self::RXState), RPCError>;
fn rx_read_param<T>(
        &mut self,
        name: &'static str,
        state: &mut Self::RXState
    ) -> Result<T, RPCError>
    where
        T: Deserialize<'de>
;
fn tx_response(
        &mut self,
        value: impl Serialize
    ) -> Result<(), RPCError>; }

Trait for RPC transport (server). ESSRPC attempts to make as few assumptions about the transport as possible. A transport may work across a network, via any IPC mechanism, or purely in memory within a single process.

Associated Types

type RXState

Type of transport-internal state used when receiving a call on the server. May be unit if the transport does not need to track state or does so through member variables.

Loading content...

Required methods

fn rx_begin_call(
    &mut self
) -> Result<(PartialMethodId, Self::RXState), RPCError>

Begin reading a method cal on the server. Returns the method name or identifier and internal state.

fn rx_read_param<T>(
    &mut self,
    name: &'static str,
    state: &mut Self::RXState
) -> Result<T, RPCError> where
    T: Deserialize<'de>, 

Read a method parameter after a an rx_begin_call. Parameters are always read in order, so some transports may choose to ignore the name.

fn tx_response(
    &mut self,
    value: impl Serialize
) -> Result<(), RPCError>

Transmit a response (from the server side) to a method call.

Loading content...

Implementors

impl<C: Read + Write> ServerTransport for BincodeTransport<C>[src]

type RXState = ()

impl<C: Read + Write> ServerTransport for JSONTransport<C>[src]

type RXState = JRXState

Loading content...