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;
// Provided methods
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> { ... }
}Expand description
Notification RPC.
Required Associated Constants§
Sourceconst ID: ProcedureId
const ID: ProcedureId
The identifier of the procedure.
Required Associated Types§
Sourcetype Notification: Send + 'static
type Notification: Send + 'static
Notification message.
Sourcetype Encoder: Encode<Item = Self::Notification> + Send + 'static
type Encoder: Encode<Item = Self::Notification> + Send + 'static
Notification message encoder.
Sourcetype Decoder: Decode<Item = Self::Notification> + Send + 'static
type Decoder: Decode<Item = Self::Notification> + Send + 'static
Notification message decoder.
Provided Methods§
Sourcefn enable_async(notification: &Self::Notification) -> bool
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.
Sourcefn client(service: &ClientServiceHandle) -> CastClient<'_, Self>
fn client(service: &ClientServiceHandle) -> CastClient<'_, Self>
Makes a new RPC client.
Sourcefn client_with_encoder(
service: &ClientServiceHandle,
encoder: Self::Encoder,
) -> CastClient<'_, Self>
fn client_with_encoder( service: &ClientServiceHandle, encoder: Self::Encoder, ) -> CastClient<'_, Self>
Makes a new RPC client with the given encoder maker.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.