Trait Message

Source
pub trait Message:
    Debug
    + Send
    + Unpin
    + 'static {
    // Required methods
    fn message_id(&self) -> u64;
    fn control_code(&self) -> ProtosocketControlCode;
    fn set_message_id(&mut self, message_id: u64);
    fn cancelled(message_id: u64) -> Self;
    fn ended(message_id: u64) -> Self;
}
Expand description

A protosocket message.

Required Methods§

Source

fn message_id(&self) -> u64

This is used to relate requests to responses. An RPC response has the same id as the request that generated it.

Source

fn control_code(&self) -> ProtosocketControlCode

Set the protosocket behavior of this message.

Source

fn set_message_id(&mut self, message_id: u64)

This is used to relate requests to responses. An RPC response has the same id as the request that generated it. When the message is sent, protosocket will set this value.

Source

fn cancelled(message_id: u64) -> Self

Create a message with a message with a cancel control code - used by the framework to handle cancellation.

Source

fn ended(message_id: u64) -> Self

Create a message with a message with an ended control code - used by the framework to handle streaming completion.

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.

Implementors§