Struct MqttBytes
#[repr(transparent)]pub struct MqttBytes([u8]);Expand description
A byte slice that satisfies the MQTT v5 Binary Data length limit (at most 65 535 bytes).
This is an unsized type like [[u8]]. Use it for borrowed
references and MqttBytesBuf for owned values.
Tuple Fields§
§0: [u8]Implementations§
§impl MqttBytes
impl MqttBytes
pub const EMPTY: &'static Self
pub const EMPTY: &'static Self
The empty bytes.
pub(super) const fn from_validated(data: &[u8]) -> &Self
pub(super) const fn from_validated(data: &[u8]) -> &Self
Wraps data, which the caller has already validated.
pub const fn encoded_len(&self) -> usize
pub const fn encoded_len(&self) -> usize
Returns the number of bytes needed to encode this value.
§impl MqttBytes
impl MqttBytes
pub fn try_to_owned(&self) -> Result<MqttBytesBuf, TryReserveError>
Available on crate feature alloc only.
pub fn try_to_owned(&self) -> Result<MqttBytesBuf, TryReserveError>
alloc only.Copies the data into an MqttBytesBuf without panicking if the
allocation fails.
§Errors
Returns TryReserveError if the allocation fails.
Trait Implementations§
§impl AsRef<MqttBytes> for MqttBytesBuf
Available on crate feature alloc only.
impl AsRef<MqttBytes> for MqttBytesBuf
Available on crate feature
alloc only.§impl Borrow<MqttBytes> for MqttBytesBuf
Available on crate feature alloc only.
impl Borrow<MqttBytes> for MqttBytesBuf
Available on crate feature
alloc only.impl Eq for MqttBytes
impl StructuralPartialEq for MqttBytes
§impl ToOwned for MqttBytes
Available on crate feature alloc only.
impl ToOwned for MqttBytes
Available on crate feature
alloc only.§type Owned = MqttBytesBuf
type Owned = MqttBytesBuf
The resulting type after obtaining ownership.
§fn to_owned(&self) -> Self::Owned
fn to_owned(&self) -> Self::Owned
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