pub struct BusMessage {
pub id: String,
pub content: Value,
pub source: String,
pub target: Option<String>,
pub template: Option<String>,
pub timestamp: DateTime<Utc>,
pub metadata: Metadata,
}Expand description
Inter-agent or user steering message.
Fields§
§id: StringStable message id used for idempotent send and consume.
content: ValueRenderable text or JSON content.
source: StringSender identifier such as user, main, or a subagent id.
target: Option<String>Recipient agent id. None means broadcast to all subscribers.
template: Option<String>Optional template string. The Rust context stores the value; rendering is caller-owned.
timestamp: DateTime<Utc>Message creation time.
metadata: MetadataAdditional message metadata.
Implementations§
Source§impl BusMessage
impl BusMessage
Sourcepub fn text(content: impl Into<String>, source: impl Into<String>) -> Self
pub fn text(content: impl Into<String>, source: impl Into<String>) -> Self
Create a text bus message.
Sourcepub fn with_target(self, target: impl Into<String>) -> Self
pub fn with_target(self, target: impl Into<String>) -> Self
Set target recipient.
Sourcepub fn with_source(self, source: impl Into<String>) -> Self
pub fn with_source(self, source: impl Into<String>) -> Self
Set source sender.
Sourcepub fn with_template(self, template: impl Into<String>) -> Self
pub fn with_template(self, template: impl Into<String>) -> Self
Set template metadata.
Sourcepub fn content_text(&self) -> String
pub fn content_text(&self) -> String
Return message text for logs, steering, and display.
Sourcepub fn render_text(&self) -> String
pub fn render_text(&self) -> String
Render message content. Minimal template support keeps raw content unless no JSON text exists.
Trait Implementations§
Source§impl Clone for BusMessage
impl Clone for BusMessage
Source§fn clone(&self) -> BusMessage
fn clone(&self) -> BusMessage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BusMessage
impl Debug for BusMessage
Source§impl<'de> Deserialize<'de> for BusMessage
impl<'de> Deserialize<'de> for BusMessage
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
impl Eq for BusMessage
Source§impl PartialEq for BusMessage
impl PartialEq for BusMessage
Source§impl Serialize for BusMessage
impl Serialize for BusMessage
impl StructuralPartialEq for BusMessage
Auto Trait Implementations§
impl Freeze for BusMessage
impl RefUnwindSafe for BusMessage
impl Send for BusMessage
impl Sync for BusMessage
impl Unpin for BusMessage
impl UnsafeUnpin for BusMessage
impl UnwindSafe for BusMessage
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