TopicFilter

Struct TopicFilter 

#[repr(transparent)]
pub struct TopicFilter<S: ?Sized>(S);
Expand description

A MQTT topic filter.

This type works as a wrapper around any AsRef<str> type. Typically used as either a reference (TopicFilter<str>) or an owned string (TopicFilter<Box<str>>).

All the interesting methods are implemented on the TopicFilter<str> variant, but other types automatically deref to it.

Tuple Fields§

§0: S

Implementations§

§

impl TopicFilter<str>

pub const fn new_ref(filter: &str) -> &Self

Creates a new topic filter reference.

pub fn to_boxed_str(&self) -> TopicFilter<Box<str>>

Converts the topic filter reference into an owned version.

pub fn contains_wildcard(&self) -> bool

Returns true if the topic filter contains any wildcard characters.

pub fn matches(&self, topic: &str) -> bool

Checks if the topic filter matches the given topic.

§

impl TopicFilter<Box<str>>

pub const fn to_ref(&self) -> &TopicFilter<str>

Converts the owned topic filter into a reference.

§

impl<S: AsRef<str>> TopicFilter<S>

pub fn new(inner: S) -> Self

Creates a new topic filter wrapping the given inner type.

pub fn into_inner(self) -> S

Consumes the topic filter and returns the inner type.

§

impl<S: ?Sized + AsRef<str>> TopicFilter<S>

pub fn as_str(&self) -> &str

Returns the topic filter as a string slice.

Trait Implementations§

§

impl<S: ?Sized + AsRef<str>> AsRef<TopicFilter<str>> for TopicFilter<S>

§

fn as_ref(&self) -> &TopicFilter<str>

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

impl<S: ?Sized + AsRef<str>> AsRef<str> for TopicFilter<S>

§

fn as_ref(&self) -> &str

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

impl Borrow<TopicFilter<str>> for TopicFilter<Box<str>>

§

fn borrow(&self) -> &TopicFilter<str>

Immutably borrows from an owned value. Read more
§

impl<S: ?Sized + AsRef<str>> Borrow<str> for TopicFilter<S>

§

fn borrow(&self) -> &str

Immutably borrows from an owned value. Read more
§

impl<S: Clone + ?Sized> Clone for TopicFilter<S>

§

fn clone(&self) -> TopicFilter<S>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<S: Debug + ?Sized> Debug for TopicFilter<S>

§

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

Formats the value using the given formatter. Read more
§

impl Deref for TopicFilter<Box<str>>

§

type Target = TopicFilter<str>

The resulting type after dereferencing.
§

fn deref(&self) -> &Self::Target

Dereferences the value.
§

impl<S> Ord for TopicFilter<S>
where S: ?Sized + AsRef<str>,

§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
§

impl<Lhs, Rhs> PartialEq<TopicFilter<Rhs>> for TopicFilter<Lhs>
where Lhs: ?Sized + AsRef<str>, Rhs: ?Sized + AsRef<str>,

§

fn eq(&self, other: &TopicFilter<Rhs>) -> 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<Lhs, Rhs> PartialOrd<TopicFilter<Rhs>> for TopicFilter<Lhs>
where Lhs: ?Sized + AsRef<str>, Rhs: ?Sized + AsRef<str>,

§

fn partial_cmp(&self, other: &TopicFilter<Rhs>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl<S: ?Sized + AsRef<str>> Eq for TopicFilter<S>

Auto Trait Implementations§

§

impl<S> Freeze for TopicFilter<S>
where S: Freeze + ?Sized,

§

impl<S> RefUnwindSafe for TopicFilter<S>
where S: RefUnwindSafe + ?Sized,

§

impl<S> Send for TopicFilter<S>
where S: Send + ?Sized,

§

impl<S> Sync for TopicFilter<S>
where S: Sync + ?Sized,

§

impl<S> Unpin for TopicFilter<S>
where S: Unpin + ?Sized,

§

impl<S> UnwindSafe for TopicFilter<S>
where S: UnwindSafe + ?Sized,

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
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more