pub struct DecodeStreamState { /* private fields */ }Expand description
Per-stream UTF-8-safe decode state. Owned by the caller.
BPE / byte-level tokenizers (Qwen3, GPT-2, etc.) sometimes emit a single
token that carries only part of a multi-byte UTF-8 character (e.g. one
byte of a CJK ideograph or emoji). Decoding tokens one-at-a-time without
buffering breaks those multi-byte sequences and produces U+FFFD
replacement characters in the output stream. This state mirrors what the
HuggingFace tokenizers::DecodeStream keeps internally so that we can own
it externally and feed tokens through TokenizerBridge::step_decode.
Use one DecodeStreamState per generation request; reset (or drop &
re-create) it between independent requests.
Implementations§
Trait Implementations§
Source§impl Default for DecodeStreamState
impl Default for DecodeStreamState
Source§fn default() -> DecodeStreamState
fn default() -> DecodeStreamState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DecodeStreamState
impl RefUnwindSafe for DecodeStreamState
impl Send for DecodeStreamState
impl Sync for DecodeStreamState
impl Unpin for DecodeStreamState
impl UnsafeUnpin for DecodeStreamState
impl UnwindSafe for DecodeStreamState
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