Skip to main content

AsyncRpcFunc

Trait AsyncRpcFunc 

Source
pub trait AsyncRpcFunc<T>:
    Send
    + Sync
    + 'static {
    type Resp: Serialize + ToRPCType + 'static;
    type Fut: Future<Output = Result<Self::Resp>> + Send + 'static;

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

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

Required Associated Types§

Source

type Resp: Serialize + ToRPCType + 'static

Source

type Fut: Future<Output = Result<Self::Resp>> + Send + 'static

Required Methods§

Source

fn call(&self, req: T) -> Self::Fut

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

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

Source§

type Resp = R

Source§

type Fut = Fut