[][src]Trait fibers_rpc::Call

pub trait Call: Sized + Send + Sync + 'static {
    type Req: Send + 'static;
    type ReqEncoder: Encode<Item = Self::Req> + Send + 'static;
    type ReqDecoder: Decode<Item = Self::Req> + Send + 'static;
    type Res: Send + 'static;
    type ResEncoder: Encode<Item = Self::Res> + Send + 'static;
    type ResDecoder: Decode<Item = Self::Res> + Send + 'static;

    const ID: ProcedureId;
    const NAME: &'static str;
    fn enable_async_request(request: &Self::Req) -> bool { ... }
fn enable_async_response(response: &Self::Res) -> bool { ... }
fn client(service: &ClientServiceHandle) -> CallClient<Self>
    where
        Self::ReqEncoder: Default,
        Self::ResDecoder: Default
, { ... }
fn client_with_decoder(
        service: &ClientServiceHandle,
        decoder: Self::ResDecoder
    ) -> CallClient<Self>
    where
        Self::ReqEncoder: Default
, { ... }
fn client_with_encoder(
        service: &ClientServiceHandle,
        encoder: Self::ReqEncoder
    ) -> CallClient<Self>
    where
        Self::ResDecoder: Default
, { ... }
fn client_with_codec(
        service: &ClientServiceHandle,
        decoder: Self::ResDecoder,
        encoder: Self::ReqEncoder
    ) -> CallClient<Self> { ... } }

Request/response RPC.

Associated Types

type Req: Send + 'static

Request message.

type ReqEncoder: Encode<Item = Self::Req> + Send + 'static

Request message encoder.

type ReqDecoder: Decode<Item = Self::Req> + Send + 'static

Request message decoder.

type Res: Send + 'static

Response message.

type ResEncoder: Encode<Item = Self::Res> + Send + 'static

Response message encoder.

type ResDecoder: Decode<Item = Self::Res> + Send + 'static

Response message decoder.

Loading content...

Associated Constants

const ID: ProcedureId

The identifier of the procedure.

const NAME: &'static str

The name of the procedure.

This is only used for debugging purpose.

Loading content...

Provided methods

fn enable_async_request(request: &Self::Req) -> bool

If it returns true, encoding/decoding request messages will be executed asynchronously.

For large RPC messages, asynchronous encoding/decoding may improve real-time property (especially if messages will be encoded/decoded by using serde).

The default implementation always return false.

fn enable_async_response(response: &Self::Res) -> bool

If it returns true, encoding/decoding response messages will be executed asynchronously.

For large RPC messages, asynchronous encoding/decoding may improve real-time property (especially if messages will be encoded/decoded by using serde).

The default implementation always return false.

fn client(service: &ClientServiceHandle) -> CallClient<Self> where
    Self::ReqEncoder: Default,
    Self::ResDecoder: Default

Makes a new RPC client.

fn client_with_decoder(
    service: &ClientServiceHandle,
    decoder: Self::ResDecoder
) -> CallClient<Self> where
    Self::ReqEncoder: Default

Makes a new RPC client with the given decoder maker.

fn client_with_encoder(
    service: &ClientServiceHandle,
    encoder: Self::ReqEncoder
) -> CallClient<Self> where
    Self::ResDecoder: Default

Makes a new RPC client with the given encoder maker.

fn client_with_codec(
    service: &ClientServiceHandle,
    decoder: Self::ResDecoder,
    encoder: Self::ReqEncoder
) -> CallClient<Self>

Makes a new RPC client with the given decoder and encoder makers.

Loading content...

Implementors

Loading content...