[][src]Trait fibers_rpc::Cast

pub trait Cast: Sized + Sync + Send + 'static {
    type Notification: Send + 'static;
    type Encoder: Encode<Item = Self::Notification> + Send + 'static;
    type Decoder: Decode<Item = Self::Notification> + Send + 'static;

    const ID: ProcedureId;
    const NAME: &'static str;
    fn enable_async(notification: &Self::Notification) -> bool { ... }
fn client(service: &ClientServiceHandle) -> CastClient<'_, Self>
    where
        Self::Encoder: Default
, { ... }
fn client_with_encoder(
        service: &ClientServiceHandle,
        encoder: Self::Encoder
    ) -> CastClient<'_, Self> { ... } }

Notification RPC.

Associated Types

type Notification: Send + 'static

Notification message.

type Encoder: Encode<Item = Self::Notification> + Send + 'static

Notification message encoder.

type Decoder: Decode<Item = Self::Notification> + Send + 'static

Notification 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(notification: &Self::Notification) -> bool

If it returns true, encoding/decoding notification 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) -> CastClient<'_, Self> where
    Self::Encoder: Default

Makes a new RPC client.

fn client_with_encoder(
    service: &ClientServiceHandle,
    encoder: Self::Encoder
) -> CastClient<'_, Self>

Makes a new RPC client with the given encoder maker.

Loading content...

Implementors

Loading content...