Skip to main content

RpcFunc

Trait RpcFunc 

Source
pub trait RpcFunc<T>:
    Send
    + Sync
    + 'static {
    type Resp: Serialize + ToRPCType + 'static;

    // Required method
    fn call(&self, req: T) -> Result<Self::Resp>;
}
Expand description

A trait that captures the relationship between a request type T and its response.

Required Associated Types§

Source

type Resp: Serialize + ToRPCType + 'static

Required Methods§

Source

fn call(&self, req: T) -> Result<Self::Resp>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T, R, F> RpcFunc<T> for F
where T: DeserializeOwned + Debug + Send + Sync + ToRPCType + 'static, R: Serialize + ToRPCType + 'static, F: Fn(T) -> Result<R> + Send + Sync + 'static,

Source§

type Resp = R