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 const unsafe fn new_unchecked(data: &[u8]) -> &Self
pub const unsafe fn new_unchecked(data: &[u8]) -> &Self
Create binary data without validating the length invariant.
§Safety
The caller must guarantee that data.len() <= 65_535.
pub const fn encoded_len(&self) -> usize
pub const fn encoded_len(&self) -> usize
Returns the number of bytes needed to encode this value.
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 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