pub(crate) struct DelimitedToolCallParser {
spec: DialectSpec,
text: ChannelState,
reasoning: ChannelState,
next_id: u32,
}Expand description
Parser for delimited tool-call dialects, configured by a
DialectSpec. See module docs.
Fields§
§spec: DialectSpecThe dialect being parsed: markers, body codecs, and ID prefix.
text: ChannelState§reasoning: ChannelState§next_id: u32Monotonic counter for synthesised tool-call IDs. Shared across both channels so IDs remain globally unique within a single stream.
Implementations§
Source§impl DelimitedToolCallParser
impl DelimitedToolCallParser
Sourcepub(crate) fn new(spec: DialectSpec) -> Self
pub(crate) fn new(spec: DialectSpec) -> Self
Construct a fresh parser for spec with empty per-channel buffers.
Sourcefn scan(&mut self, channel: Channel, chunk: &str) -> ParserOutput
fn scan(&mut self, channel: Channel, chunk: &str) -> ParserOutput
Drive the state machine for one channel.
All scanning logic lives here; push_text and push_reasoning are
thin dispatch wrappers that pick the right ChannelState and route
flushed bytes to the right output field.
Sourcefn flush_channel(&mut self, channel: Channel) -> ParserOutput
fn flush_channel(&mut self, channel: Channel) -> ParserOutput
Flush a single channel at end-of-stream.
Trait Implementations§
Source§impl Debug for DelimitedToolCallParser
impl Debug for DelimitedToolCallParser
Source§impl ToolCallParser for DelimitedToolCallParser
impl ToolCallParser for DelimitedToolCallParser
Source§fn push_text(&mut self, chunk: &str) -> ParserOutput
fn push_text(&mut self, chunk: &str) -> ParserOutput
Feed a chunk that arrived on the upstream text channel.
Source§fn push_reasoning(&mut self, chunk: &str) -> ParserOutput
fn push_reasoning(&mut self, chunk: &str) -> ParserOutput
Feed a chunk that arrived on the upstream reasoning channel.
Source§fn finish(&mut self) -> ParserOutput
fn finish(&mut self) -> ParserOutput
Flush any buffered partial state at end-of-stream. Read more
Auto Trait Implementations§
impl Freeze for DelimitedToolCallParser
impl RefUnwindSafe for DelimitedToolCallParser
impl Send for DelimitedToolCallParser
impl Sync for DelimitedToolCallParser
impl Unpin for DelimitedToolCallParser
impl UnsafeUnpin for DelimitedToolCallParser
impl UnwindSafe for DelimitedToolCallParser
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