Trait merfolk::interfaces::Middleware[][src]

pub trait Middleware: Send {
    type Backend: Backend;
    fn wrap_call(
        &self,
        call: Result<Call<<Self::Backend as Backend>::Intermediate>>
    ) -> Result<Call<<Self::Backend as Backend>::Intermediate>>;
fn wrap_reply(
        &self,
        call: Result<Reply<<Self::Backend as Backend>::Intermediate>>
    ) -> Result<Reply<<Self::Backend as Backend>::Intermediate>>;
fn unwrap_call(
        &self,
        reply: Result<Call<<Self::Backend as Backend>::Intermediate>>
    ) -> Result<Call<<Self::Backend as Backend>::Intermediate>>;
fn unwrap_reply(
        &self,
        reply: Result<Reply<<Self::Backend as Backend>::Intermediate>>
    ) -> Result<Reply<<Self::Backend as Backend>::Intermediate>>;
fn as_any(&mut self) -> &mut dyn Any; }

Middlewares are used to Modify RPCs or to add extra functionality to the framework.

Outgoing RPCs

The outgoing Call<Intermediate>s are processed by the wrap_call function and passed on. The incomming Reply<Intermediate>s are processed by the unwrap_reply function and passed on.

Incomming RPCs

The incomming Call<Intermediate>s are processed by the unwrap_call function and passed on. The outgoing Reply<Intermediate>s are processed by the wrap_reply function and passed on.

Examples

For examples look at the provided Middlewares:

Associated Types

Loading content...

Required methods

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

Wraps the outgoing call Call<Intermediate>

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

Wraps the outgoing reply Reply<Intermediate>

fn unwrap_call(
    &self,
    reply: Result<Call<<Self::Backend as Backend>::Intermediate>>
) -> Result<Call<<Self::Backend as Backend>::Intermediate>>
[src]

Unwraps the incomming call Call<Intermediate>

fn unwrap_reply(
    &self,
    reply: Result<Reply<<Self::Backend as Backend>::Intermediate>>
) -> Result<Reply<<Self::Backend as Backend>::Intermediate>>
[src]

Unwraps the imcomming reply Reply<Intermediate>

fn as_any(&mut self) -> &mut dyn Any[src]

return self as Any. Needed for downcasting when accessing a Middleware through Mer.

implement like this fn as_any(&mut self) -> &mut dyn core::any::Any { self }

Loading content...

Implementors

Loading content...