pub enum MessageId {
Uuid(u128),
Sequence(u64),
Custom(String),
ContentHash(u64),
}Expand description
A unique identifier for messages.
Message IDs can be generated using various strategies:
- UUID: Globally unique, good for distributed systems
- Sequence: Monotonically increasing, good for ordered processing
- Custom: User-provided identifier (e.g., from source system)
Variants§
Uuid(u128)
A UUID-based identifier (128-bit).
Sequence(u64)
A sequence-based identifier (64-bit).
Custom(String)
A custom string identifier.
ContentHash(u64)
A hash-based identifier derived from content.
Implementations§
Source§impl MessageId
impl MessageId
Sourcepub const fn new_sequence(seq: u64) -> Self
pub const fn new_sequence(seq: u64) -> Self
Create a new sequence-based message ID.
Sourcepub fn new_custom(id: impl Into<String>) -> Self
pub fn new_custom(id: impl Into<String>) -> Self
Create a custom message ID from a string.
Sourcepub fn from_content(content: &[u8]) -> Self
pub fn from_content(content: &[u8]) -> Self
Create a content-hash message ID from the given bytes.
Sourcepub const fn is_sequence(&self) -> bool
pub const fn is_sequence(&self) -> bool
Returns true if this is a sequence-based ID.
Sourcepub const fn is_content_hash(&self) -> bool
pub const fn is_content_hash(&self) -> bool
Returns true if this is a content-hash ID.
Trait Implementations§
impl Eq for MessageId
impl StructuralPartialEq for MessageId
Auto Trait Implementations§
impl Freeze for MessageId
impl RefUnwindSafe for MessageId
impl Send for MessageId
impl Sync for MessageId
impl Unpin for MessageId
impl UnwindSafe for MessageId
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