pub struct ConversationId(/* private fields */);Expand description
Groups every message in one business conversation. Always derived, never minted: an
un-correlated message roots its own conversation at its MessageId (see
crate::EnvelopeBuilder::build), and any other value is inherited from storage or the
wire via Self::from_uuid. There is deliberately no new()/Default — a random,
unrooted conversation id would silently drop a caller out of the conversation it supplied
(ADR 0038); a host that wants to start one names the UUID explicitly.
use reliar_core::ConversationId;
use uuid::Uuid;
// Wrap an id read back from storage or the wire without inspecting its version.
let existing = Uuid::now_v7();
let conversation = ConversationId::from_uuid(existing);
assert_eq!(conversation.as_uuid(), existing);
assert!(!conversation.is_unset());Implementations§
Source§impl ConversationId
impl ConversationId
Source§impl ConversationId
impl ConversationId
Sourcepub const UNSET: Self
pub const UNSET: Self
The reserved “not yet rooted” sentinel: the nil UUID. CorrelationMetadata’s
default uses it, and EnvelopeBuilder::build replaces it with the envelope’s own id —
conversation rooting is decided by this value, not by which builder setter was called.
Self::from_uuid of any non-nil UUIDv7 is therefore never UNSET. An application
SHALL NOT use the nil UUID as a real conversation id.
use reliar_core::ConversationId;
use uuid::Uuid;
assert!(ConversationId::UNSET.is_unset());
assert!(!ConversationId::from_uuid(Uuid::now_v7()).is_unset());Sourcepub const fn is_unset(&self) -> bool
pub const fn is_unset(&self) -> bool
true when this id is Self::UNSET.
use reliar_core::ConversationId;
use uuid::Uuid;
assert!(ConversationId::UNSET.is_unset());
assert!(!ConversationId::from_uuid(Uuid::now_v7()).is_unset());Trait Implementations§
Source§impl Clone for ConversationId
impl Clone for ConversationId
Source§fn clone(&self) -> ConversationId
fn clone(&self) -> ConversationId
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ConversationId
Source§impl Debug for ConversationId
impl Debug for ConversationId
Source§impl<'de> Deserialize<'de> for ConversationId
Available on crate feature serde only.
impl<'de> Deserialize<'de> for ConversationId
serde only.Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Source§impl Display for ConversationId
impl Display for ConversationId
impl Eq for ConversationId
Source§impl Hash for ConversationId
impl Hash for ConversationId
Source§impl Ord for ConversationId
impl Ord for ConversationId
Source§fn cmp(&self, other: &ConversationId) -> Ordering
fn cmp(&self, other: &ConversationId) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ConversationId
impl PartialEq for ConversationId
Source§impl PartialOrd for ConversationId
impl PartialOrd for ConversationId
Source§impl Serialize for ConversationId
Available on crate feature serde only.
impl Serialize for ConversationId
serde only.