pub struct PlainTextRenderer { /* private fields */ }Expand description
Plain text renderer with optional ANSI styling.
This renderer outputs text directly to stdout with optional ANSI escape codes for styling thinking blocks and tool use.
Implementations§
Source§impl PlainTextRenderer
impl PlainTextRenderer
Sourcepub fn with_color(use_color: bool) -> Self
pub fn with_color(use_color: bool) -> Self
Creates a new PlainTextRenderer with specified color setting.
Sourcepub fn with_interrupt(self, interrupted: Arc<AtomicBool>) -> Self
pub fn with_interrupt(self, interrupted: Arc<AtomicBool>) -> Self
Attaches an interrupt flag to the renderer.
Sourcepub fn with_color_and_interrupt(
use_color: bool,
interrupted: Arc<AtomicBool>,
) -> Self
pub fn with_color_and_interrupt( use_color: bool, interrupted: Arc<AtomicBool>, ) -> Self
Creates a new PlainTextRenderer with specified color and interrupt flag.
Trait Implementations§
Source§impl Default for PlainTextRenderer
impl Default for PlainTextRenderer
Source§impl Renderer for PlainTextRenderer
impl Renderer for PlainTextRenderer
Source§fn start_agent(&mut self, context: &dyn StreamContext)
fn start_agent(&mut self, context: &dyn StreamContext)
Called when a stream begins.
Source§fn finish_agent(
&mut self,
context: &dyn StreamContext,
stop_reason: Option<&StopReason>,
)
fn finish_agent( &mut self, context: &dyn StreamContext, stop_reason: Option<&StopReason>, )
Called when a stream finishes.
Source§fn print_text(&mut self, context: &dyn StreamContext, text: &str)
fn print_text(&mut self, context: &dyn StreamContext, text: &str)
Print a chunk of regular response text. Read more
Source§fn print_thinking(&mut self, context: &dyn StreamContext, text: &str)
fn print_thinking(&mut self, context: &dyn StreamContext, text: &str)
Print a chunk of thinking text. Read more
Source§fn print_error(&mut self, context: &dyn StreamContext, error: &str)
fn print_error(&mut self, context: &dyn StreamContext, error: &str)
Print an error message.
Source§fn print_info(&mut self, context: &dyn StreamContext, info: &str)
fn print_info(&mut self, context: &dyn StreamContext, info: &str)
Print an informational message.
Source§fn start_tool_use(&mut self, context: &dyn StreamContext, name: &str, id: &str)
fn start_tool_use(&mut self, context: &dyn StreamContext, name: &str, id: &str)
Called when a tool use block starts. Read more
Source§fn print_tool_input(&mut self, context: &dyn StreamContext, partial_json: &str)
fn print_tool_input(&mut self, context: &dyn StreamContext, partial_json: &str)
Print a chunk of tool input JSON. Read more
Source§fn finish_tool_use(&mut self, context: &dyn StreamContext)
fn finish_tool_use(&mut self, context: &dyn StreamContext)
Called when a tool use block is complete. Read more
Source§fn start_tool_result(
&mut self,
context: &dyn StreamContext,
tool_use_id: &str,
is_error: bool,
)
fn start_tool_result( &mut self, context: &dyn StreamContext, tool_use_id: &str, is_error: bool, )
Called when the model streams a tool result block.
Source§fn print_tool_result_text(&mut self, context: &dyn StreamContext, text: &str)
fn print_tool_result_text(&mut self, context: &dyn StreamContext, text: &str)
Print tool result text content.
Source§fn finish_tool_result(&mut self, context: &dyn StreamContext)
fn finish_tool_result(&mut self, context: &dyn StreamContext)
Called when a tool result block is complete.
Source§fn finish_response(&mut self, context: &dyn StreamContext)
fn finish_response(&mut self, context: &dyn StreamContext)
Called when a response is complete. Read more
Source§fn print_interrupted(&mut self, context: &dyn StreamContext)
fn print_interrupted(&mut self, context: &dyn StreamContext)
Called when the stream is interrupted by the user.
Source§fn should_interrupt(&self) -> bool
fn should_interrupt(&self) -> bool
Returns true if streaming should be interrupted.
Source§fn read_operator_line(&mut self, prompt: &str) -> Result<Option<OperatorLine>>
fn read_operator_line(&mut self, prompt: &str) -> Result<Option<OperatorLine>>
Reads a line of operator input, if this renderer is interactive. Read more
Auto Trait Implementations§
impl Freeze for PlainTextRenderer
impl RefUnwindSafe for PlainTextRenderer
impl Send for PlainTextRenderer
impl Sync for PlainTextRenderer
impl Unpin for PlainTextRenderer
impl UnsafeUnpin for PlainTextRenderer
impl UnwindSafe for PlainTextRenderer
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