pub struct MessageGroup {
pub group_type: MessageGroupType,
pub primary: Message,
pub tool_calls: Vec<ToolCallWithResult>,
pub start_timestamp: Option<String>,
pub end_timestamp: Option<String>,
}Expand description
A group of related messages for consolidated rendering.
Represents a logical unit of conversation: a primary message (user question or assistant response) along with all associated tool calls and their results. This enables rendering an entire interaction as a cohesive block rather than separate messages.
Fields§
§group_type: MessageGroupTypeGroup type for rendering decisions.
primary: MessageThe primary message (user or assistant text).
tool_calls: Vec<ToolCallWithResult>Tool calls paired with their results.
start_timestamp: Option<String>Timestamp of the first message/action in this group.
end_timestamp: Option<String>Timestamp of the last message/action in this group.
Implementations§
Source§impl MessageGroup
impl MessageGroup
Sourcepub fn new(primary: Message, group_type: MessageGroupType) -> Self
pub fn new(primary: Message, group_type: MessageGroupType) -> Self
Create a new message group with a primary message.
Sourcepub fn add_tool_call(&mut self, call: ToolCall, correlation_id: Option<String>)
pub fn add_tool_call(&mut self, call: ToolCall, correlation_id: Option<String>)
Add a tool call to this group.
Sourcepub fn add_tool_result(&mut self, result: ToolResult)
pub fn add_tool_result(&mut self, result: ToolResult)
Add a tool result, matching it with an existing call by correlation ID.
If a matching call is found, the result is attached to it. If no match is found, the result is dropped with a warning.
Sourcepub fn update_end_timestamp(&mut self, timestamp: Option<String>)
pub fn update_end_timestamp(&mut self, timestamp: Option<String>)
Update the end timestamp if the given timestamp is later.
Sourcepub fn tool_count(&self) -> usize
pub fn tool_count(&self) -> usize
Get the number of tool calls in this group.
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Check if any tool call in this group resulted in an error.
Sourcepub fn all_tools_complete(&self) -> bool
pub fn all_tools_complete(&self) -> bool
Check if all tool calls have results.
Sourcepub fn tool_summary(&self) -> (usize, usize, usize)
pub fn tool_summary(&self) -> (usize, usize, usize)
Get a summary of tool call statuses for display.
Trait Implementations§
Source§impl Clone for MessageGroup
impl Clone for MessageGroup
Source§fn clone(&self) -> MessageGroup
fn clone(&self) -> MessageGroup
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for MessageGroup
impl RefUnwindSafe for MessageGroup
impl Send for MessageGroup
impl Sync for MessageGroup
impl Unpin for MessageGroup
impl UnsafeUnpin for MessageGroup
impl UnwindSafe for MessageGroup
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more