pub struct Message {
pub id: String,
pub payload: Arc<Value>,
pub context: Value,
pub audit_trail: Vec<AuditTrail>,
pub errors: Vec<ErrorInfo>,
/* private fields */
}
Fields§
§id: String
§payload: Arc<Value>
§context: Value
Unified context containing data, metadata, and temp_data
audit_trail: Vec<AuditTrail>
§errors: Vec<ErrorInfo>
Errors that occurred during message processing
Implementations§
Source§impl Message
impl Message
pub fn new(payload: Arc<Value>) -> Self
Sourcepub fn get_context_arc(&mut self) -> Arc<Value>
pub fn get_context_arc(&mut self) -> Arc<Value>
Get or create an Arc reference to the context This method returns a cached Arc if available, or creates and caches a new one
Sourcepub fn invalidate_context_cache(&mut self)
pub fn invalidate_context_cache(&mut self)
Invalidate the cached context Arc Call this whenever the context is modified
Sourcepub fn from_value(payload: &Value) -> Self
pub fn from_value(payload: &Value) -> Self
Convenience method for creating a message from a Value reference Note: This clones the entire Value. Use from_arc() to avoid cloning when possible.
Sourcepub fn from_arc(payload: Arc<Value>) -> Self
pub fn from_arc(payload: Arc<Value>) -> Self
Create a message from an Arc
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Check if message has errors
Sourcepub fn metadata_mut(&mut self) -> &mut Value
pub fn metadata_mut(&mut self) -> &mut Value
Get a mutable reference to the metadata field in context
Sourcepub fn temp_data_mut(&mut self) -> &mut Value
pub fn temp_data_mut(&mut self) -> &mut Value
Get a mutable reference to the temp_data field in context
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Message
impl<'de> Deserialize<'de> for Message
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
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
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