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§
§impl TopicFilter
impl TopicFilter
pub(super) const fn from_validated(s: &MqttStr) -> &Self
pub(super) const fn from_validated(s: &MqttStr) -> &Self
Wraps s, which the caller has already validated.
pub const fn new(s: &MqttStr) -> Result<&Self, TopicError>
pub const fn new(s: &MqttStr) -> Result<&Self, TopicError>
Validates and creates a new topic filter from a validated MqttStr.
§Errors
Returns TopicError if the string is empty or has invalid wildcard
placement.
pub const fn as_mqtt_str(&self) -> &MqttStr
pub const fn as_mqtt_str(&self) -> &MqttStr
Views the topic filter as an MqttStr.
pub fn has_wildcard(&self) -> bool
pub fn has_wildcard(&self) -> bool
Returns true if the filter contains a + or # wildcard.
Returns true if this is a shared subscription filter ($share/...).
§impl TopicFilter
impl TopicFilter
pub fn try_to_owned(&self) -> Result<TopicFilterBuf, TryReserveError>
Available on crate feature alloc only.
pub fn try_to_owned(&self) -> Result<TopicFilterBuf, TryReserveError>
alloc only.Copies the filter into a TopicFilterBuf without panicking if the
allocation fails.
§Errors
Returns TryReserveError if the allocation fails.
Trait Implementations§
§impl AsRef<MqttStr> for TopicFilter
impl AsRef<MqttStr> for TopicFilter
§impl AsRef<TopicFilter> for TopicFilterBuf
Available on crate feature alloc only.
impl AsRef<TopicFilter> for TopicFilterBuf
alloc only.§fn as_ref(&self) -> &TopicFilter
fn as_ref(&self) -> &TopicFilter
§impl AsRef<str> for TopicFilter
impl AsRef<str> for TopicFilter
§impl Borrow<TopicFilter> for TopicFilterBuf
Available on crate feature alloc only.
impl Borrow<TopicFilter> for TopicFilterBuf
alloc only.§fn borrow(&self) -> &TopicFilter
fn borrow(&self) -> &TopicFilter
§impl Debug for TopicFilter
impl Debug for TopicFilter
§impl Display for TopicFilter
impl Display for TopicFilter
impl Eq for TopicFilter
§impl From<&TopicFilter> for TopicFilterBuf
Available on crate feature alloc only.
impl From<&TopicFilter> for TopicFilterBuf
alloc only.§fn from(value: &TopicFilter) -> Self
fn from(value: &TopicFilter) -> Self
§impl Hash for TopicFilter
impl Hash for TopicFilter
§impl Ord for TopicFilter
impl Ord for TopicFilter
§impl PartialEq for TopicFilter
impl PartialEq for TopicFilter
§impl PartialOrd for TopicFilter
impl PartialOrd for TopicFilter
impl StructuralPartialEq for TopicFilter
§impl ToOwned for TopicFilter
Available on crate feature alloc only.
impl ToOwned for TopicFilter
alloc only.