#[repr(transparent)]pub struct Messages(pub Vec<Content>);Tuple Fields§
§0: Vec<Content>Implementations§
Source§impl Messages
impl Messages
Sourcepub fn push(&mut self, content: Content) -> &mut Messages
pub fn push(&mut self, content: Content) -> &mut Messages
Appends a Content to this Messages, merging parts when the last entry has the same role.
If the provided content has the same role as the last stored Content, its parts are appended to that last Content instead of adding a new entry.
§Examples
ⓘ
let mut msgs = Messages(Vec::new());
msgs.push(content::from_system(vec!["first"]));
msgs.push(content::from_system(vec!["second"]));
assert_eq!(msgs.len(), 1);Sourcepub fn extend(&mut self, messages: Messages) -> &mut Messages
pub fn extend(&mut self, messages: Messages) -> &mut Messages
Appends all Content items from messages into this Messages in order.
This moves the contained Content values out of messages and into self.
§Examples
ⓘ
use crate::messages::content;
use crate::messages::Messages;
let mut a = Messages(vec![content::from_user(vec!["hello"])]);
let b = Messages(vec![content::from_system(vec!["system"])]);
a.extend(b);
assert_eq!(a.len(), 2);pub fn is_empty(&self) -> bool
Sourcepub fn find_tool_mut(&mut self, id: &CallId) -> Option<&mut Tool>
pub fn find_tool_mut(&mut self, id: &CallId) -> Option<&mut Tool>
Walk every Content and return the first Tool part whose id
matches. Used by HITL callers to mutate a pending tool’s status
in place (tool.approve(...), tool.reject(...), etc) before
calling Chat::resume.
pub fn find_tool(&self, id: &CallId) -> Option<&Tool>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Messages
impl RefUnwindSafe for Messages
impl Send for Messages
impl Sync for Messages
impl Unpin for Messages
impl UnsafeUnpin for Messages
impl UnwindSafe for Messages
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