pub struct ToolWatcher {
pub start_id: u32,
pub end_id: u32,
pub start_name: String,
pub end_name: String,
/* private fields */
}Expand description
Stateful watcher for delimited regions in a token-ID stream.
Construct with a map and the names of the start/end specials. The
watcher resolves them to IDs once and caches them — no further map
access happens during ToolWatcher::feed.
Fields§
§start_id: u32§end_id: u32§start_name: String§end_name: StringImplementations§
Source§impl ToolWatcher
impl ToolWatcher
pub fn new( map: &TokenizerMap, start_name: &str, end_name: &str, ) -> Result<Self, ToolWatcherError>
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Drop any in-flight region buffer. Call between conversations so a leftover unclosed region from session N doesn’t spill into N+1.
Sourcepub fn feed(&mut self, ids: &[u32]) -> Vec<WatcherEvent>
pub fn feed(&mut self, ids: &[u32]) -> Vec<WatcherEvent>
Feed a chunk of token IDs and receive a flat list of events.
Sourcepub fn feed_i32(&mut self, ids: &[i32]) -> Vec<WatcherEvent>
pub fn feed_i32(&mut self, ids: &[i32]) -> Vec<WatcherEvent>
Convenience: feed an i32 slice (the wire frame’s natural type
from .NET surface familiarity). Internally upcast to u32.
Auto Trait Implementations§
impl Freeze for ToolWatcher
impl RefUnwindSafe for ToolWatcher
impl Send for ToolWatcher
impl Sync for ToolWatcher
impl Unpin for ToolWatcher
impl UnsafeUnpin for ToolWatcher
impl UnwindSafe for ToolWatcher
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