pub struct TextMessageContentEvent {
pub base: BaseEvent,
pub message_id: MessageId,
pub delta: String,
}Expand description
Event containing a piece of text message content.
This event is sent for each chunk of content as the agent generates a message. The delta field contains the new text to append to the message.
§Validation
The delta must not be empty. Use new() which returns a Result to validate,
or new_unchecked() if you’ve already validated the input.
Fields§
§base: BaseEventCommon event fields (timestamp, rawEvent).
message_id: MessageIdThe message ID this content belongs to.
delta: StringThe text content delta to append.
Implementations§
Source§impl TextMessageContentEvent
impl TextMessageContentEvent
Sourcepub fn new(
message_id: impl Into<MessageId>,
delta: impl Into<String>,
) -> Result<Self, EventValidationError>
pub fn new( message_id: impl Into<MessageId>, delta: impl Into<String>, ) -> Result<Self, EventValidationError>
Creates a new TextMessageContentEvent with validation.
Returns an error if delta is empty.
Sourcepub fn new_unchecked(
message_id: impl Into<MessageId>,
delta: impl Into<String>,
) -> Self
pub fn new_unchecked( message_id: impl Into<MessageId>, delta: impl Into<String>, ) -> Self
Creates a new TextMessageContentEvent without validation.
Use this only if you’ve already validated the delta is not empty.
Sourcepub fn validate(&self) -> Result<(), EventValidationError>
pub fn validate(&self) -> Result<(), EventValidationError>
Validates this event’s data.
Sourcepub fn with_timestamp(self, timestamp: f64) -> Self
pub fn with_timestamp(self, timestamp: f64) -> Self
Sets the timestamp for this event.
Trait Implementations§
Source§impl Clone for TextMessageContentEvent
impl Clone for TextMessageContentEvent
Source§fn clone(&self) -> TextMessageContentEvent
fn clone(&self) -> TextMessageContentEvent
Returns a duplicate of the value. Read more
1.0.0 · 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 TextMessageContentEvent
impl Debug for TextMessageContentEvent
Source§impl<'de> Deserialize<'de> for TextMessageContentEvent
impl<'de> Deserialize<'de> for TextMessageContentEvent
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
Source§impl PartialEq for TextMessageContentEvent
impl PartialEq for TextMessageContentEvent
Source§impl Serialize for TextMessageContentEvent
impl Serialize for TextMessageContentEvent
impl StructuralPartialEq for TextMessageContentEvent
Auto Trait Implementations§
impl Freeze for TextMessageContentEvent
impl RefUnwindSafe for TextMessageContentEvent
impl Send for TextMessageContentEvent
impl Sync for TextMessageContentEvent
impl Unpin for TextMessageContentEvent
impl UnsafeUnpin for TextMessageContentEvent
impl UnwindSafe for TextMessageContentEvent
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