pub struct ThinkStripper { /* private fields */ }Expand description
Streaming stripper for <think>...</think> and <thinking>...</thinking>
blocks. Case-insensitive, attribute-tolerant, safe across feed boundaries
even when a tag is split mid-UTF-8 sequence.
Implementations§
Source§impl ThinkStripper
impl ThinkStripper
pub fn new() -> Self
pub fn buffered_bytes(&self) -> usize
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Reset to the pristine state. Call between turns — otherwise an
unclosed <think> from a previous turn (model got cancelled, got
an error mid-stream, switched provider, etc.) leaves inside=true
and silently swallows every TextDelta of the next turn. Symptom:
user sees blank assistant bubbles even though the provider returned
normal text.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ThinkStripper
impl RefUnwindSafe for ThinkStripper
impl Send for ThinkStripper
impl Sync for ThinkStripper
impl Unpin for ThinkStripper
impl UnsafeUnpin for ThinkStripper
impl UnwindSafe for ThinkStripper
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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