Skip to main content

RawPayload

Struct RawPayload 

Source
pub struct RawPayload { /* private fields */ }
Expand description

A concrete PayloadWireFormat backed by heap-allocated storage.

SD messages are stored as a VecSdHeader; all other messages are stored as opaque bytes. This type is suitable as the payload parameter for Message<RawPayload> in FFI bindings or any context where a fixed, non-generic payload type is needed.

Implementations§

Source§

impl RawPayload

Source

pub fn raw_bytes(&self) -> Option<&[u8]>

Returns the raw payload bytes for non-SD messages, or None for SD messages.

Trait Implementations§

Source§

impl Clone for RawPayload

Source§

fn clone(&self) -> RawPayload

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RawPayload

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for RawPayload

Source§

fn eq(&self, other: &RawPayload) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PayloadWireFormat for RawPayload

Source§

type SdHeader = VecSdHeader

The SD header type used by this payload implementation.
Source§

fn message_id(&self) -> MessageId

Get the Message ID for the payload
Source§

fn as_sd_header(&self) -> Option<&VecSdHeader>

Get the payload as a service discovery header
Source§

fn from_payload_bytes( message_id: MessageId, payload: &[u8], ) -> Result<Self, Error>

Construct a payload from raw bytes and a message ID. Read more
Source§

fn new_sd_payload(header: &VecSdHeader) -> Self

Create a PayloadWireFormat from a service discovery Header
Source§

fn sd_flags(&self) -> Option<Flags>

Return the SD flags if this payload is a service discovery message.
Source§

fn required_size(&self) -> usize

Number of bytes required to write the payload
Source§

fn encode<T: Write>(&self, writer: &mut T) -> Result<usize, Error>

Serialize the payload to a Writer Read more
Source§

fn new_subscription_sd_header( service_id: u16, instance_id: u16, major_version: u8, ttl: u32, event_group_id: u16, client_ip: Ipv4Addr, protocol: TransportProtocol, client_port: u16, reboot_flag: RebootFlag, ) -> VecSdHeader

Construct an SD header for subscribing to an event group.
Source§

fn set_reboot_flag(header: &mut VecSdHeader, reboot: RebootFlag)

Override the reboot flag on an SD header in-place. Read more
Source§

fn offered_endpoints(&self) -> Vec<OfferedEndpoint>

Extract offered/stopped service endpoints from this SD payload. Read more
Source§

fn service_instances(&self) -> Vec<(u16, u16)>

Return (service_id, instance_id) pairs for every SD entry in this payload, regardless of entry type. Read more
Source§

impl Eq for RawPayload

Source§

impl StructuralPartialEq for RawPayload

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more