pub struct Message {
pub payload: Value,
pub session_id: Option<SessionId>,
pub sender: Option<SenderHandle>,
pub type_name: Option<String>,
}Expand description
A message that can be sent to an agent.
Fields§
§payload: ValueThe message payload as a JSON value.
session_id: Option<SessionId>Phase 3: Session ID for protocol tracking.
sender: Option<SenderHandle>Phase 3: Handle for replying to this message.
type_name: Option<String>Phase 3: Type name for protocol validation.
Implementations§
Source§impl Message
impl Message
Sourcepub fn new<T: Serialize>(value: T) -> SageResult<Self>
pub fn new<T: Serialize>(value: T) -> SageResult<Self>
Create a new message from a serializable value.
Sourcepub fn with_session<T: Serialize>(
value: T,
session_id: SessionId,
sender: SenderHandle,
type_name: impl Into<String>,
) -> SageResult<Self>
pub fn with_session<T: Serialize>( value: T, session_id: SessionId, sender: SenderHandle, type_name: impl Into<String>, ) -> SageResult<Self>
Create a new message with session context.
Sourcepub fn with_type_name(self, type_name: impl Into<String>) -> Self
pub fn with_type_name(self, type_name: impl Into<String>) -> Self
Set the type name for this message.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnsafeUnpin 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