#[non_exhaustive]pub struct PrintEventHandler { /* private fields */ }Expand description
Simple event handler that prints to stdout.
This handler is useful for CLI applications and debugging. It prints text directly to stdout and formats tool usage and results in a readable manner.
§Example
use gba_core::event::PrintEventHandler;
let mut handler = PrintEventHandler::default();
// Use with Engine::run_stream() or Session::send_stream()Implementations§
Source§impl PrintEventHandler
impl PrintEventHandler
Sourcepub fn with_tools(self) -> Self
pub fn with_tools(self) -> Self
Enable showing tool usage details.
Sourcepub fn with_auto_flush(self) -> Self
pub fn with_auto_flush(self) -> Self
Enable auto-flushing stdout after each text output.
This is useful for real-time streaming output where you want each piece of text to appear immediately.
Trait Implementations§
Source§impl Debug for PrintEventHandler
impl Debug for PrintEventHandler
Source§impl Default for PrintEventHandler
impl Default for PrintEventHandler
Source§fn default() -> PrintEventHandler
fn default() -> PrintEventHandler
Returns the “default value” for a type. Read more
Source§impl EventHandler for PrintEventHandler
impl EventHandler for PrintEventHandler
Source§fn on_tool_use(&mut self, tool: &str, input: &Value)
fn on_tool_use(&mut self, tool: &str, input: &Value)
Called when Claude starts using a tool. Read more
Source§fn on_tool_result(&mut self, result: &str)
fn on_tool_result(&mut self, result: &str)
Called when a tool returns a result. Read more
Source§fn on_error(&mut self, error_msg: &str)
fn on_error(&mut self, error_msg: &str)
Called when an error occurs during streaming. Read more
Source§fn on_complete(&mut self)
fn on_complete(&mut self)
Called when the response is complete.
Auto Trait Implementations§
impl Freeze for PrintEventHandler
impl RefUnwindSafe for PrintEventHandler
impl Send for PrintEventHandler
impl Sync for PrintEventHandler
impl Unpin for PrintEventHandler
impl UnwindSafe for PrintEventHandler
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