Trait merfolk::interfaces::Frontend[][src]

pub trait Frontend: Send {
    type Backend: Backend;
    fn register<T>(&mut self, caller: T) -> Result<()>
    where
        T: Fn(Call<<Self::Backend as Backend>::Intermediate>) -> Result<Reply<<Self::Backend as Backend>::Intermediate>> + Send + Sync + 'static
;
fn receive(
        &self,
        call: Call<<Self::Backend as Backend>::Intermediate>
    ) -> Result<Reply<<Self::Backend as Backend>::Intermediate>>; }

The Frontend is responsible for processing incomming RPCs and for passing on outgoing RPCs to the Backend. The Frontend provides a way to make calls on the client side and a way to register procedures on the server side.

Incomming RPCs

The Frontend is acting as server.

Incomming Call<Intermediate>s are received from the Backend. The calls are deserialized via Backend::deserialize to the correct type. The calls are processed and the replys serialized via Backend::serialize and passed on to the Backend as Reply<Intermediate>.

Outgoing RPCs

The Frontend is acting as client.

The Frontend serializes the calls via Backend::serialize and passes them to the Backend as Call<Intermediate>. The replies are received from the Backend deserialized via Backend::deserialize passed on as response.

Examples

For examples look at the provided Frontends:

Associated Types

type Backend: Backend[src]

The used Backend.

Loading content...

Required methods

fn register<T>(&mut self, caller: T) -> Result<()> where
    T: Fn(Call<<Self::Backend as Backend>::Intermediate>) -> Result<Reply<<Self::Backend as Backend>::Intermediate>> + Send + Sync + 'static, 
[src]

Registers the client callback function from Mer. The callback is used to pass outgoing Calls to the Backend.

fn receive(
    &self,
    call: Call<<Self::Backend as Backend>::Intermediate>
) -> Result<Reply<<Self::Backend as Backend>::Intermediate>>
[src]

This function is called by the Backend for incomming Calls.

Loading content...

Implementors

Loading content...