pub struct MessageType(/* private fields */);Expand description
A validated message type identifier.
Message types use dot-separated namespacing convention. Examples: “timer.tick”, “user.created”, “system.shutdown”
§Validation Rules
- Cannot be empty
- Contain only lowercase letters, digits, dots, hyphens, underscores
- Cannot start or end with a dot
- Cannot have consecutive dots
Implementations§
Source§impl MessageType
impl MessageType
Sourcepub fn new(value: impl Into<String>) -> Result<Self, InvalidMessageType>
pub fn new(value: impl Into<String>) -> Result<Self, InvalidMessageType>
Creates a new message type after validation.
§Errors
Returns an error if the message type is invalid.
Sourcepub fn parts(&self) -> Vec<&str>
pub fn parts(&self) -> Vec<&str>
Returns the namespace parts.
For “user.created”, returns ["user", "created"].
Sourcepub fn category(&self) -> Option<&str>
pub fn category(&self) -> Option<&str>
Returns the first part of the message type (the category).
For “user.created”, returns Some("user").
Sourcepub fn matches_pattern(&self, pattern: &str) -> bool
pub fn matches_pattern(&self, pattern: &str) -> bool
Checks if this message type matches a pattern with wildcards.
Supports * at the end to match any suffix.
Examples:
- “timer.tick” matches “timer.tick” (exact)
- “timer.tick” matches “timer.*” (wildcard)
- “system.started.timer” matches “system.started.*” (wildcard)
Trait Implementations§
Source§impl AsRef<str> for MessageType
impl AsRef<str> for MessageType
Source§impl Clone for MessageType
impl Clone for MessageType
Source§fn clone(&self) -> MessageType
fn clone(&self) -> MessageType
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MessageType
impl Debug for MessageType
Source§impl<'de> Deserialize<'de> for MessageType
impl<'de> Deserialize<'de> for MessageType
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for MessageType
impl Display for MessageType
Source§impl FromStr for MessageType
impl FromStr for MessageType
Source§impl Hash for MessageType
impl Hash for MessageType
Source§impl PartialEq for MessageType
impl PartialEq for MessageType
Source§impl Serialize for MessageType
impl Serialize for MessageType
impl Eq for MessageType
impl StructuralPartialEq for MessageType
Auto Trait Implementations§
impl Freeze for MessageType
impl RefUnwindSafe for MessageType
impl Send for MessageType
impl Sync for MessageType
impl Unpin for MessageType
impl UnsafeUnpin for MessageType
impl UnwindSafe for MessageType
Blanket Implementations§
Source§impl<T> ActonMessage for T
impl<T> ActonMessage for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PrefixFactory for T
impl<T> PrefixFactory for T
Source§fn create_prefix_sanitized(&self) -> TypeIdPrefix
fn create_prefix_sanitized(&self) -> TypeIdPrefix
Sanitizes the input and creates a valid
TypeIdPrefix. Read moreSource§fn try_create_prefix(&self) -> Result<TypeIdPrefix, ValidationError>
fn try_create_prefix(&self) -> Result<TypeIdPrefix, ValidationError>
Attempts to create a
TypeIdPrefix from the input without modifying it. Read more