pub struct Event {
pub id: String,
pub topic: String,
pub source: String,
pub payload: String,
pub privacy_boundary: String,
pub timestamp_ms: u64,
pub correlation_id: Option<String>,
}Expand description
A message on the bus. Agents produce and consume these.
Fields§
§id: StringUnique event identifier.
topic: StringTopic string for pub/sub routing (e.g. “task.image.complete”).
source: StringWho published this event (agent_id, channel name, or “system”).
payload: StringEvent payload — typically JSON, but can be any string.
privacy_boundary: StringPrivacy boundary inherited from the source (e.g. “local_only”, “any”).
timestamp_ms: u64Unix timestamp in milliseconds.
correlation_id: Option<String>Traces a chain of events back to the original trigger. All events in an agent chain share the same correlation_id.
Implementations§
Source§impl Event
impl Event
Sourcepub fn new(
topic: impl Into<String>,
source: impl Into<String>,
payload: impl Into<String>,
) -> Self
pub fn new( topic: impl Into<String>, source: impl Into<String>, payload: impl Into<String>, ) -> Self
Create a new event with a generated id and current timestamp.
Sourcepub fn with_correlation(self, id: impl Into<String>) -> Self
pub fn with_correlation(self, id: impl Into<String>) -> Self
Set the correlation id (builder pattern).
Sourcepub fn with_boundary(self, boundary: impl Into<String>) -> Self
pub fn with_boundary(self, boundary: impl Into<String>) -> Self
Set the privacy boundary (builder pattern).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Event
impl<'de> Deserialize<'de> for Event
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 Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnsafeUnpin for Event
impl UnwindSafe for Event
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