TopicFilters

Struct TopicFilters 

#[repr(transparent)]
pub struct TopicFilters([u8]);
Expand description

Borrowed view over a validated UNSUBSCRIBE payload.

Each entry is a length-prefixed topic filter string (§3.10.3). Use TopicFiltersBuf to build one, or TopicFilters::new to validate and borrow existing encoded bytes.

Tuple Fields§

§0: [u8]

Implementations§

§

impl TopicFilters

pub const EMPTY: &'static Self

An empty topic filters payload.

pub const fn new(bytes: &[u8]) -> Result<&Self, DecodeError>

Validates raw UNSUBSCRIBE payload bytes and returns a TopicFilters reference.

§Errors

Returns DecodeError if any entry is malformed: a truncated or invalid topic filter string.

pub const unsafe fn new_unchecked(bytes: &[u8]) -> &Self

Creates a TopicFilters reference from raw bytes WITHOUT validation.

§Safety

The caller must guarantee that bytes contains only structurally valid entries: each is a length-prefixed valid topic filter string.

pub const fn as_bytes(&self) -> &[u8]

Returns the raw encoded bytes.

pub const fn is_empty(&self) -> bool

Returns true if the payload contains no topic filters.

pub const fn iter(&self) -> TopicFilterIter<'_>

Iterates over the topic filters in this payload.

Trait Implementations§

§

impl AsRef<TopicFilters> for TopicFiltersBuf

Available on crate feature alloc only.
§

fn as_ref(&self) -> &TopicFilters

Converts this type into a shared reference of the (usually inferred) input type.
§

impl Borrow<TopicFilters> for TopicFiltersBuf

Available on crate feature alloc only.
§

fn borrow(&self) -> &TopicFilters

Immutably borrows from an owned value. Read more
§

impl Debug for TopicFilters

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl Hash for TopicFilters

§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
§

impl<'a> IntoIterator for &'a TopicFilters

§

type Item = &'a TopicFilter

The type of the elements being iterated over.
§

type IntoIter = TopicFilterIter<'a>

Which kind of iterator are we turning this into?
§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
§

impl PartialEq for TopicFilters

§

fn eq(&self, other: &TopicFilters) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl ToOwned for TopicFilters

Available on crate feature alloc only.
§

type Owned = TopicFiltersBuf

The resulting type after obtaining ownership.
§

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)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl Eq for TopicFilters

§

impl StructuralPartialEq for TopicFilters

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more