[][src]Struct fizyr_rpc::MessageHeader

#[repr(C)]pub struct MessageHeader {
    pub message_type: MessageType,
    pub request_id: u32,
    pub service_id: i32,
}

A message header.

Fields

message_type: MessageType

The message type.

request_id: u32

The request that the message is part of.

Unused for stream messages.

service_id: i32

The service that the message is for.

For request messages, this indicates the service being requested.

For response messages this indicates success or failure.

For update messages this indicates the type of update.

Implementations

impl MessageHeader[src]

pub fn request(request_id: u32, service_id: i32) -> Self[src]

Create a new request message header.

pub fn response(request_id: u32, service_id: i32) -> Self[src]

Create a new response message header.

pub fn error_response(request_id: u32) -> Self[src]

Create a new error response message header.

pub fn requester_update(request_id: u32, service_id: i32) -> Self[src]

Create a new requester update message header.

pub fn responder_update(request_id: u32, service_id: i32) -> Self[src]

Create a new responder update message header.

pub fn stream(request_id: u32, service_id: i32) -> Self[src]

Create a new stream message header.

pub fn decode(buffer: &[u8]) -> Result<Self, InvalidMessageType>[src]

Decode a message header from a byte slice.

The byte slice should NOT contain the message size.

Panic

This function panics if the buffer does not contain a full header.

pub fn encode(&self, buffer: &mut [u8])[src]

Encode a message header into a byte slice.

This will NOT add a message size (which would be impossible even if we wanted to).

Panic

This function panics if the buffer is not large enough to hold a full header.

Trait Implementations

impl Clone for MessageHeader[src]

impl Copy for MessageHeader[src]

impl Debug for MessageHeader[src]

impl Eq for MessageHeader[src]

impl Hash for MessageHeader[src]

impl Ord for MessageHeader[src]

impl PartialEq<MessageHeader> for MessageHeader[src]

impl PartialOrd<MessageHeader> for MessageHeader[src]

impl StructuralEq for MessageHeader[src]

impl StructuralPartialEq for MessageHeader[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.