[−][src]Trait essrpc::ServerTransport
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.
Required methods
fn rx_begin_call(
&mut self
) -> Result<(PartialMethodId, Self::RXState), RPCError>
&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>,
&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>
&mut self,
value: impl Serialize
) -> Result<(), RPCError>
Transmit a response (from the server side) to a method call.
Implementors
impl<C: Read + Write> ServerTransport for BincodeTransport<C>
[src]
type RXState = ()
fn rx_begin_call(&mut self) -> Result<(PartialMethodId, ()), RPCError>
[src]
fn rx_read_param<T>(
&mut self,
_name: &'static str,
_state: &mut ()
) -> Result<T, RPCError> where
T: Deserialize<'de>,
[src]
&mut self,
_name: &'static str,
_state: &mut ()
) -> Result<T, RPCError> where
T: Deserialize<'de>,
fn tx_response(
&mut self,
value: impl Serialize
) -> Result<(), RPCError>
[src]
&mut self,
value: impl Serialize
) -> Result<(), RPCError>
impl<C: Read + Write> ServerTransport for JSONTransport<C>
[src]
type RXState = JRXState
fn rx_begin_call(&mut self) -> Result<(PartialMethodId, JRXState), RPCError>
[src]
fn rx_read_param<T>(
&mut self,
name: &'static str,
state: &mut JRXState
) -> Result<T, RPCError> where
T: Deserialize<'de>,
[src]
&mut self,
name: &'static str,
state: &mut JRXState
) -> Result<T, RPCError> where
T: Deserialize<'de>,
fn tx_response(
&mut self,
value: impl Serialize
) -> Result<(), RPCError>
[src]
&mut self,
value: impl Serialize
) -> Result<(), RPCError>