Trait fibers_rpc::Cast [−][src]
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.
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.
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,
Self::Encoder: Default,
Makes a new RPC client.
fn client_with_encoder(
service: &ClientServiceHandle,
encoder: Self::Encoder
) -> CastClient<Self>
service: &ClientServiceHandle,
encoder: Self::Encoder
) -> CastClient<Self>
Makes a new RPC client with the given encoder maker.