pub struct DisplayMessage {
pub role: MessageRole,
pub content: String,
pub thinking: Option<String>,
pub tool_calls: Vec<DisplayToolCall>,
pub assistant_blocks: Vec<DisplayAssistantBlock>,
pub is_streaming: bool,
pub timestamp: u64,
}Expand description
A message formatted for display in the chat view.
Fields§
§role: MessageRole§content: String§thinking: Option<String>§tool_calls: Vec<DisplayToolCall>§assistant_blocks: Vec<DisplayAssistantBlock>§is_streaming: bool§timestamp: u64Implementations§
Source§impl DisplayMessage
impl DisplayMessage
Sourcepub fn from_message(msg: &Message) -> Self
pub fn from_message(msg: &Message) -> Self
Construct from an imp_llm Message.
pub fn add_assistant_text_block(&mut self, text: &str)
pub fn push_assistant_text_delta(&mut self, text: &str)
pub fn push_assistant_thought_duration(&mut self, seconds: u64)
pub fn push_assistant_tool_call(&mut self, tool_call: DisplayToolCall)
Sourcepub fn line_count(&self, theme: &Theme, highlighter: &Highlighter) -> usize
pub fn line_count(&self, theme: &Theme, highlighter: &Highlighter) -> usize
Calculate the rendered line count for this message.
Trait Implementations§
Source§impl Clone for DisplayMessage
impl Clone for DisplayMessage
Source§fn clone(&self) -> DisplayMessage
fn clone(&self) -> DisplayMessage
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 moreAuto Trait Implementations§
impl Freeze for DisplayMessage
impl RefUnwindSafe for DisplayMessage
impl Send for DisplayMessage
impl Sync for DisplayMessage
impl Unpin for DisplayMessage
impl UnsafeUnpin for DisplayMessage
impl UnwindSafe for DisplayMessage
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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>
Converts
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>
Converts
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