pub struct UserMessage {
pub role: UserRole,
pub content: MessageContent,
pub timestamp: i64,
pub visible: bool,
}Expand description
Stable since 0.63.0
Message types for constructing conversations.
User message sent to the model.Fields§
§role: UserRoleRole discriminator (always UserRole::User).
content: MessageContentMessage content – either a plain string or a list of content blocks.
timestamp: i64Unix-epoch milliseconds when the message was created.
visible: boolWhether this message renders in the transcript. false for synthetic
reminders/nudges the model must see but the human should not (they are
not something the human typed). Always sent to the provider regardless
of this flag — it is display-only metadata. Missing on old session
files deserializes to true (backward compat).
Implementations§
Source§impl UserMessage
impl UserMessage
Sourcepub fn new(content: impl Into<MessageContent>) -> Self
pub fn new(content: impl Into<MessageContent>) -> Self
Create a new user message with the current timestamp.
A message sent to the model but not rendered in the transcript.
Trait Implementations§
Source§impl Clone for UserMessage
impl Clone for UserMessage
Source§fn clone(&self) -> UserMessage
fn clone(&self) -> UserMessage
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 UserMessage
impl Debug for UserMessage
Source§impl<'de> Deserialize<'de> for UserMessage
impl<'de> Deserialize<'de> for UserMessage
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 UserMessage
impl RefUnwindSafe for UserMessage
impl Send for UserMessage
impl Sync for UserMessage
impl Unpin for UserMessage
impl UnsafeUnpin for UserMessage
impl UnwindSafe for UserMessage
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