pub struct TopicPath {
pub path: ArcStr,
pub segments: Vec<Substr>,
}Expand description
A concrete MQTT topic, split into its /-delimited segments.
The original topic string and the segment slices share the same backing
ArcStr allocation, so cloning and slicing are cheap.
Fields§
§path: ArcStrThe full topic string.
segments: Vec<Substr>The topic split on /; each segment is a slice into path.
Implementations§
Source§impl TopicPath
impl TopicPath
Sourcepub fn new(path: impl Into<ArcStr>) -> Result<Self, TopicPathError>
pub fn new(path: impl Into<ArcStr>) -> Result<Self, TopicPathError>
Builds a TopicPath by splitting path on / into segments.
Rejects a topic that is not well-formed per MQTT §4.7.3: an empty string, or one containing the null character (U+0000). Every other UTF-8 topic — including spaces and the discouraged-but-legal U+0001..U+001F control range — is accepted. The 65535-byte length ceiling is left to the wire codec, not enforced here.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TopicPath
impl RefUnwindSafe for TopicPath
impl Send for TopicPath
impl Sync for TopicPath
impl Unpin for TopicPath
impl UnsafeUnpin for TopicPath
impl UnwindSafe for TopicPath
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more