Trait merfolk::interfaces::Backend [−][src]
The Backend
is responsible for sending and receiving RPCs.
The Backend
serializes and deserializes the packages and sends and reveices them over a chsen channel.
Incomming RPCs
The Backend
is acting as server.
Incomming calls from the client are passed on to the Frontend
as Call
<Intermediate
>
.
The Reply
<Intermediate
>
s from the Frontend
are sent back to the client.
Outgoing RPCs
The Backend
is acting as client.
The Frontend
passes Call
<Intermediate
>
s to the Backend
which sends them to the server.
The replies are received from the server and passed on to the Frontend
as Reply
<Intermediate
>
s.
Examples
For examples look at the provided Backend
s:
Associated Types
type Intermediate: Serialize + for<'a> Deserialize<'a>
[src]
The Intermediate type required by the Backend
.
Required methods
fn register<T>(&mut self, receiver: T) -> Result<()> where
T: Fn(Call<Self::Intermediate>) -> Result<Reply<Self::Intermediate>> + Send + Sync + 'static,
[src]
T: Fn(Call<Self::Intermediate>) -> Result<Reply<Self::Intermediate>> + Send + Sync + 'static,
Registers the server callback function from Mer
. The callback is used to pass incomming Call
s to the Frontend
.
fn call(
&mut self,
call: Call<Self::Intermediate>
) -> Result<Reply<Self::Intermediate>>
[src]
&mut self,
call: Call<Self::Intermediate>
) -> Result<Reply<Self::Intermediate>>
fn serialize<T: Serialize>(from: &T) -> Result<Self::Intermediate>
[src]
Serializes a type T
to the Intermediate
type.
fn deserialize<T>(from: &Self::Intermediate) -> Result<T> where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
Deserializes the Intermediate
type to a type T
.