Struct Subscriptions
#[repr(transparent)]pub struct Subscriptions([u8]);Expand description
Borrowed view over a validated SUBSCRIBE payload.
Each entry is a length-prefixed topic filter followed by an options byte
(§3.8.3). Use SubscriptionsBuf to build one,
or Subscriptions::new to validate and borrow existing encoded bytes.
Tuple Fields§
§0: [u8]Implementations§
§impl Subscriptions
impl Subscriptions
pub const EMPTY: &'static Self
pub const EMPTY: &'static Self
An empty subscriptions payload.
pub const fn new(bytes: &[u8]) -> Result<&Self, DecodeError>
pub const fn new(bytes: &[u8]) -> Result<&Self, DecodeError>
Validates raw SUBSCRIBE payload bytes and returns a Subscriptions
reference.
§Errors
Returns DecodeError if any entry has a truncated or invalid topic
filter or an invalid options byte.
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 validated.
pub const fn iter(&self) -> SubscriptionIter<'_> ⓘ
pub const fn iter(&self) -> SubscriptionIter<'_> ⓘ
Iterates over the subscription entries in this payload.
Trait Implementations§
§impl AsRef<Subscriptions> for SubscriptionsBuf
Available on crate feature alloc only.
impl AsRef<Subscriptions> for SubscriptionsBuf
Available on crate feature
alloc only.§fn as_ref(&self) -> &Subscriptions
fn as_ref(&self) -> &Subscriptions
Converts this type into a shared reference of the (usually inferred) input type.
§impl Borrow<Subscriptions> for SubscriptionsBuf
Available on crate feature alloc only.
impl Borrow<Subscriptions> for SubscriptionsBuf
Available on crate feature
alloc only.§fn borrow(&self) -> &Subscriptions
fn borrow(&self) -> &Subscriptions
Immutably borrows from an owned value. Read more
§impl Debug for Subscriptions
impl Debug for Subscriptions
impl Eq for Subscriptions
§impl Hash for Subscriptions
impl Hash for Subscriptions
§impl<'a> IntoIterator for &'a Subscriptions
impl<'a> IntoIterator for &'a Subscriptions
§type Item = Subscription<'a>
type Item = Subscription<'a>
The type of the elements being iterated over.
§type IntoIter = SubscriptionIter<'a>
type IntoIter = SubscriptionIter<'a>
Which kind of iterator are we turning this into?
§impl PartialEq for Subscriptions
impl PartialEq for Subscriptions
impl StructuralPartialEq for Subscriptions
§impl ToOwned for Subscriptions
Available on crate feature alloc only.
impl ToOwned for Subscriptions
Available on crate feature
alloc only.§type Owned = SubscriptionsBuf
type Owned = SubscriptionsBuf
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