Message

Struct Message 

Source
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

Source

pub fn new(payload: Arc<Value>) -> Self

Source

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

Source

pub fn invalidate_context_cache(&mut self)

Invalidate the cached context Arc Call this whenever the context is modified

Source

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.

Source

pub fn from_arc(payload: Arc<Value>) -> Self

Create a message from an Arc directly, avoiding cloning

Source

pub fn add_error(&mut self, error: ErrorInfo)

Add an error to the message

Source

pub fn has_errors(&self) -> bool

Check if message has errors

Source

pub fn data(&self) -> &Value

Get a reference to the data field in context

Source

pub fn data_mut(&mut self) -> &mut Value

Get a mutable reference to the data field in context

Source

pub fn metadata(&self) -> &Value

Get a reference to the metadata field in context

Source

pub fn metadata_mut(&mut self) -> &mut Value

Get a mutable reference to the metadata field in context

Source

pub fn temp_data(&self) -> &Value

Get a reference to the temp_data field in context

Source

pub fn temp_data_mut(&mut self) -> &mut Value

Get a mutable reference to the temp_data field in context

Trait Implementations§

Source§

impl Clone for Message

Source§

fn clone(&self) -> Message

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Message

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Message

Source§

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 Serialize for Message

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,