pub struct TextRenderer { /* private fields */ }Expand description
Stateful text-mode renderer.
Tracks the latest assistant message observed across the whole stream so that
multiple prompts, retries, and compaction rounds collapse to a single final
answer. No output is produced until finish; intermediate
streaming events only update internal state.
Implementations§
Source§impl TextRenderer
impl TextRenderer
Sourcepub fn handle(&mut self, event: &AgentSessionEvent)
pub fn handle(&mut self, event: &AgentSessionEvent)
Observe one event.
Every AgentSessionEvent variant is handled. Authoritative assistant
snapshots come from turn-end, message-end, message-update, and agent-end
so fragmented streaming and multi-turn runs coalesce into a single final
answer. Other variants are consumed without side effects so the renderer
never panics on thinking, tool, compaction, retry, or queue events.
Sourcepub fn last_assistant(&self) -> Option<&AssistantMessage>
pub fn last_assistant(&self) -> Option<&AssistantMessage>
Borrow the tracked final assistant message, if any.
Trait Implementations§
Source§impl Default for TextRenderer
impl Default for TextRenderer
Source§fn default() -> TextRenderer
fn default() -> TextRenderer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TextRenderer
impl RefUnwindSafe for TextRenderer
impl Send for TextRenderer
impl Sync for TextRenderer
impl Unpin for TextRenderer
impl UnsafeUnpin for TextRenderer
impl UnwindSafe for TextRenderer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 moreCreates a shared type from an unshared type.