Struct TopicFilter
#[repr(transparent)]pub struct TopicFilter(MqttStr);Expand description
A validated, borrowed MQTT topic filter.
Topic filters are used in SUBSCRIBE / UNSUBSCRIBE packets and may
contain the single-level wildcard + and the multi-level wildcard #.
The filter must not be empty and must satisfy MqttStr constraints.
This is an unsized type like str. Use &TopicFilter for borrowed
references and TopicFilterBuf for owned values.
Tuple Fields§
§0: MqttStrImplementations§
Source§impl TopicFilter
impl TopicFilter
Sourcepub const unsafe fn new_unchecked(s: &MqttStr) -> &TopicFilter
pub const unsafe fn new_unchecked(s: &MqttStr) -> &TopicFilter
Sourcepub const fn new(s: &MqttStr) -> Result<&TopicFilter, TopicError>
pub const fn new(s: &MqttStr) -> Result<&TopicFilter, TopicError>
Validate and create a new topic filter from a validated MqttStr.
§Errors
Returns TopicError if the string is empty or has invalid wildcard
placement.
Sourcepub const fn as_mqtt_str(&self) -> &MqttStr
pub const fn as_mqtt_str(&self) -> &MqttStr
Views the topic filter as an MqttStr.
Trait Implementations§
Source§impl AsRef<MqttStr> for TopicFilter
impl AsRef<MqttStr> for TopicFilter
Source§impl AsRef<TopicFilter> for TopicFilterBuf
impl AsRef<TopicFilter> for TopicFilterBuf
Source§fn as_ref(&self) -> &TopicFilter
fn as_ref(&self) -> &TopicFilter
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl AsRef<str> for TopicFilter
impl AsRef<str> for TopicFilter
Source§impl Borrow<TopicFilter> for TopicFilterBuf
impl Borrow<TopicFilter> for TopicFilterBuf
Source§fn borrow(&self) -> &TopicFilter
fn borrow(&self) -> &TopicFilter
Immutably borrows from an owned value. Read more
Source§impl Debug for TopicFilter
impl Debug for TopicFilter
Source§impl Display for TopicFilter
impl Display for TopicFilter
Source§impl From<&TopicFilter> for TopicFilterBuf
impl From<&TopicFilter> for TopicFilterBuf
Source§fn from(value: &TopicFilter) -> TopicFilterBuf
fn from(value: &TopicFilter) -> TopicFilterBuf
Converts to this type from the input type.
Source§impl Hash for TopicFilter
impl Hash for TopicFilter
Source§impl PartialEq for TopicFilter
impl PartialEq for TopicFilter
Source§impl ToOwned for TopicFilter
impl ToOwned for TopicFilter
Source§type Owned = TopicFilterBuf
type Owned = TopicFilterBuf
The resulting type after obtaining ownership.
Source§fn to_owned(&self) -> <TopicFilter as ToOwned>::Owned
fn to_owned(&self) -> <TopicFilter as ToOwned>::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
Source§impl<'a> TryFrom<&'a str> for &'a TopicFilter
impl<'a> TryFrom<&'a str> for &'a TopicFilter
Source§type Error = ParseTopicError
type Error = ParseTopicError
The type returned in the event of a conversion error.
Source§fn try_from(
value: &'a str,
) -> Result<&'a TopicFilter, <&'a TopicFilter as TryFrom<&'a str>>::Error>
fn try_from( value: &'a str, ) -> Result<&'a TopicFilter, <&'a TopicFilter as TryFrom<&'a str>>::Error>
Performs the conversion.