pub struct UserMessage {
pub role: UserRole,
pub content: MessageContent,
pub timestamp: i64,
}Expand description
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.
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.
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