Struct essrpc::transports::BincodeTransport
source · Expand description
Transport implementation using Bincode serialization. Can be used
over any Read+Write
channel (local socket, internet socket,
pipe, etc). The present implementation is naive with regards to
this channel – no buffering is performed.
Implementations§
Trait Implementations§
source§impl<C: Read + Write> Transport for BincodeTransport<C>
impl<C: Read + Write> Transport for BincodeTransport<C>
§type TXState = ()
type TXState = ()
Type of transport-internal state used when bulding a call for
transmission on the client. May be unit if the transport does not need to track
state or does so through member variables. Read more
§type RXState = ()
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. Read more
source§fn tx_begin_call(&mut self, method: MethodId) -> Result<(), RPCError>
fn tx_begin_call(&mut self, method: MethodId) -> Result<(), RPCError>
Begin calling the given method. The transport may begin transmitting over the wire,
or it may may wait until the call to
tx_finalize
. Read moresource§fn tx_add_param(
&mut self,
_name: &'static str,
value: impl Serialize,
_state: &mut ()
) -> Result<(), RPCError>
fn tx_add_param(
&mut self,
_name: &'static str,
value: impl Serialize,
_state: &mut ()
) -> Result<(), RPCError>
Add a parameter to a method call started with
tx_begin_call
. This method is guaranteed to be called only
after tx_begin_call
and to be called appropriately for each
parameter of the method passed to tx_begin_call
. state
is
the object returned by tx_begin_call
. Parameters are always
added and read in order, so transmitting the name is not a requirement. Read moresource§fn tx_finalize(&mut self, _state: &mut ()) -> Result<(), RPCError>
fn tx_finalize(&mut self, _state: &mut ()) -> Result<(), RPCError>
Finalize transmission of a method call. Called only after
tx_begin_call
and appropriate calls to tx_add_param
. If
the transport has not yet transmitted the method identifier
and parameters over the wire, it should do so at this time. Read moresource§fn rx_begin_call(&mut self) -> Result<(PartialMethodId, ()), RPCError>
fn rx_begin_call(&mut self) -> Result<(PartialMethodId, ()), RPCError>
Begin reading a method cal on the server. Returns the method
name or identifier and internal state. Read more
source§fn rx_read_param<T>(
&mut self,
_name: &'static str,
_state: &mut ()
) -> Result<T, RPCError>where
for<'de> T: Deserialize<'de>,
fn rx_read_param<T>(
&mut self,
_name: &'static str,
_state: &mut ()
) -> Result<T, RPCError>where
for<'de> 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. Read moresource§fn rx_response<T>(&mut self) -> Result<T, RPCError>where
for<'de> T: Deserialize<'de>,
fn rx_response<T>(&mut self) -> Result<T, RPCError>where
for<'de> T: Deserialize<'de>,
Read the return value of a method call. Always called after
tx_finalize
.