pub struct Message { /* private fields */ }Expand description
Pure wire data: {id, payload, context, audit_trail, errors}, in that
order.
Read from JSON as v3’s is: the five fields, each required, any other key
ignored. Its context reads by Context’s rules, so a fourth root is
refused, and each root must be an object: a root takes only an object,
and a null or scalar metadata would silently drop every write under
it, metadata.progress included (3.x took any value).
Implementations§
Source§impl Message
impl Message
Sourcepub fn new(payload: impl Into<Arc<OwnedDataValue>>) -> Self
pub fn new(payload: impl Into<Arc<OwnedDataValue>>) -> Self
A message with a fresh UUID v7 id, as v3. Ids made on one thread sort
in the order they were made; ids made in the same millisecond on two
threads are distinct but not ordered. A payload passed as an Arc is
shared, not copied: messages built from one Arc hold one payload.
Sourcepub fn from_parts(
payload: impl Into<Arc<OwnedDataValue>>,
data: OwnedDataValue,
metadata: OwnedDataValue,
) -> Self
pub fn from_parts( payload: impl Into<Arc<OwnedDataValue>>, data: OwnedDataValue, metadata: OwnedDataValue, ) -> Self
A message seeded with data and metadata. A seed that is not an
object is ignored, as v3. A payload passed as an Arc is shared, not
copied.
Sourcepub fn payload(&self) -> &OwnedDataValue
pub fn payload(&self) -> &OwnedDataValue
The payload the message arrived with. It is not part of the evaluation context.
Sourcepub fn context_mut(&mut self) -> &mut Context
pub fn context_mut(&mut self) -> &mut Context
The context, mutably.
Sourcepub fn audit(&self) -> &[AuditEntry]
pub fn audit(&self) -> &[AuditEntry]
The audit entries the run kept.
Sourcepub fn errors(&self) -> &[ErrorRecord]
pub fn errors(&self) -> &[ErrorRecord]
The errors recorded while processing.