Struct Payload
#[repr(transparent)]pub struct Payload([u8]);Expand description
An application message payload.
The length is at most Payload::MAX_LEN, the largest Remaining Length
of any packet. Because the topic and properties also count toward that
limit, a payload close to it can still be too large to send. This is an
unsized type like [[u8]].
Tuple Fields§
§0: [u8]Implementations§
§impl Payload
impl Payload
pub const fn new(bytes: &[u8]) -> Result<&Self, PayloadTooLarge>
pub const fn new(bytes: &[u8]) -> Result<&Self, PayloadTooLarge>
pub(super) const fn from_validated(bytes: &[u8]) -> &Self
pub(super) const fn from_validated(bytes: &[u8]) -> &Self
Wraps bytes, which the caller has already checked against
MAX_LEN.
§impl Payload
impl Payload
pub fn try_to_owned(&self) -> Result<PayloadBuf, TryReserveError>
Available on crate feature alloc only.
pub fn try_to_owned(&self) -> Result<PayloadBuf, TryReserveError>
alloc only.Copies the payload into a PayloadBuf without panicking if the
allocation fails.
§Errors
Returns TryReserveError if the allocation fails.
Trait Implementations§
§impl AsRef<Payload> for PayloadBuf
Available on crate feature alloc only.
impl AsRef<Payload> for PayloadBuf
Available on crate feature
alloc only.§impl Borrow<Payload> for PayloadBuf
Available on crate feature alloc only.
impl Borrow<Payload> for PayloadBuf
Available on crate feature
alloc only.impl Eq for Payload
impl StructuralPartialEq for Payload
§impl ToOwned for Payload
Available on crate feature alloc only.
impl ToOwned for Payload
Available on crate feature
alloc only.§type Owned = PayloadBuf
type Owned = PayloadBuf
The resulting type after obtaining ownership.
§fn to_owned(&self) -> PayloadBuf
fn to_owned(&self) -> PayloadBuf
Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · Source§fn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
Uses borrowed data to replace owned data, usually by cloning. Read more