pub struct ClaudeParser { /* private fields */ }Expand description
Claude event parser
Note: This parser is designed for single-threaded use only.
The internal state uses Rc<RefCell<>> for convenience, not for thread safety.
Do not share this parser across threads.
Implementations§
Source§impl ClaudeParser
impl ClaudeParser
Sourcepub fn new(colors: Colors, verbosity: Verbosity) -> Self
pub fn new(colors: Colors, verbosity: Verbosity) -> Self
Create a new ClaudeParser with the given colors and verbosity.
§Arguments
colors- Colors for terminal outputverbosity- Verbosity level for output
§Returns
A new ClaudeParser instance
§Example
ⓘ
use ralph_workflow::json_parser::ClaudeParser;
use ralph_workflow::logger::Colors;
use ralph_workflow::config::Verbosity;
let parser = ClaudeParser::new(Colors::new(), Verbosity::Normal);Sourcepub fn with_printer(
colors: Colors,
verbosity: Verbosity,
printer: SharedPrinter,
) -> Self
pub fn with_printer( colors: Colors, verbosity: Verbosity, printer: SharedPrinter, ) -> Self
Sourcepub fn with_display_name(self, display_name: &str) -> Self
pub fn with_display_name(self, display_name: &str) -> Self
Sourcepub fn parse_event(&self, line: &str) -> Option<String>
pub fn parse_event(&self, line: &str) -> Option<String>
Parse and display a single Claude JSON event
Returns Some(formatted_output) for valid events, or None for:
- Malformed JSON (logged at debug level)
- Unknown event types
- Empty or whitespace-only output
Auto Trait Implementations§
impl !Freeze for ClaudeParser
impl !RefUnwindSafe for ClaudeParser
impl !Send for ClaudeParser
impl !Sync for ClaudeParser
impl Unpin for ClaudeParser
impl !UnwindSafe for ClaudeParser
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> 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