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§
Trait Implementations§
Source§impl Clone for RawPayload
impl Clone for RawPayload
Source§fn clone(&self) -> RawPayload
fn clone(&self) -> RawPayload
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RawPayload
impl Debug for RawPayload
impl Eq for RawPayload
Source§impl PartialEq for RawPayload
impl PartialEq for RawPayload
Source§fn eq(&self, other: &RawPayload) -> bool
fn eq(&self, other: &RawPayload) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PayloadWireFormat for RawPayload
impl PayloadWireFormat for RawPayload
Source§type SdHeader = VecSdHeader
type SdHeader = VecSdHeader
The SD header type used by this payload implementation.
Source§fn message_id(&self) -> MessageId
fn message_id(&self) -> MessageId
Get the Message ID for the payload
Source§fn as_sd_header(&self) -> Option<&VecSdHeader>
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>
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
fn new_sd_payload(header: &VecSdHeader) -> Self
Create a
PayloadWireFormat from a service discovery HeaderSource§fn sd_flags(&self) -> Option<Flags>
fn sd_flags(&self) -> Option<Flags>
Return the SD flags if this payload is a service discovery message.
Source§fn required_size(&self) -> usize
fn required_size(&self) -> usize
Number of bytes required to write the payload
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
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)
fn set_reboot_flag(header: &mut VecSdHeader, reboot: RebootFlag)
Override the reboot flag on an SD header in-place. Read more
Source§fn for_each_offered_endpoint<F>(&self, f: F)where
F: FnMut(OfferedEndpoint),
fn for_each_offered_endpoint<F>(&self, f: F)where
F: FnMut(OfferedEndpoint),
Visit each offered / stopped service endpoint in this SD
payload with
f. Read moreSource§fn for_each_service_instance<F>(&self, f: F)
fn for_each_service_instance<F>(&self, f: F)
Visit
(service_id, instance_id) for every SD entry in this
payload, regardless of entry type, with f. Read moreSource§fn offered_endpoints(&self) -> Vec<OfferedEndpoint>
fn offered_endpoints(&self) -> Vec<OfferedEndpoint>
Convenience accessor returning all offered endpoints as a heap
Vec. Wraps Self::for_each_offered_endpoint so std users
get the original ergonomic shape; bare-metal users use the
visitor directly. Gated on feature = "std".Source§fn service_instances(&self) -> Vec<(u16, u16)>
fn service_instances(&self) -> Vec<(u16, u16)>
Convenience accessor returning all
(service_id, instance_id)
pairs as a heap Vec. Wraps
Self::for_each_service_instance for std users. Gated on
feature = "std".impl StructuralPartialEq for RawPayload
Auto Trait Implementations§
impl Freeze for RawPayload
impl RefUnwindSafe for RawPayload
impl Send for RawPayload
impl Sync for RawPayload
impl Unpin for RawPayload
impl UnsafeUnpin for RawPayload
impl UnwindSafe for RawPayload
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more