pub enum DecodeResult {
Complete(String),
Partial(String),
}Expand description
Result of decoding token IDs to text.
Distinguishes between fully valid UTF-8 output and output that contains
trailing incomplete multi-byte sequences (represented as U+FFFD).
This lets callers like DecodeStream::step() decide whether to emit or
buffer without resorting to hardcoded replacement-character string checks.
Variants§
Complete(String)
No trailing incomplete multi-byte sequences (text does not end with U+FFFD). Note: the string may still contain interior U+FFFD characters from mid-stream invalid byte sequences; only trailing status is tracked here.
Partial(String)
The decoded string ends with U+FFFD, indicating incomplete trailing multi-byte bytes that may be completed by subsequent tokens.
Implementations§
Source§impl DecodeResult
impl DecodeResult
Sourcepub const fn is_complete(&self) -> bool
pub const fn is_complete(&self) -> bool
Returns true if the enum is DecodeResult::Complete otherwise false
Sourcepub const fn is_partial(&self) -> bool
pub const fn is_partial(&self) -> bool
Returns true if the enum is DecodeResult::Partial otherwise false
Source§impl DecodeResult
impl DecodeResult
Trait Implementations§
Source§impl Clone for DecodeResult
impl Clone for DecodeResult
Source§fn clone(&self) -> DecodeResult
fn clone(&self) -> DecodeResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DecodeResult
impl Debug for DecodeResult
impl Eq for DecodeResult
Source§impl From<DecodeResult> for String
impl From<DecodeResult> for String
Source§fn from(result: DecodeResult) -> Self
fn from(result: DecodeResult) -> Self
Source§impl From<String> for DecodeResult
impl From<String> for DecodeResult
Source§impl PartialEq for DecodeResult
impl PartialEq for DecodeResult
Source§fn eq(&self, other: &DecodeResult) -> bool
fn eq(&self, other: &DecodeResult) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for DecodeResult
Auto Trait Implementations§
impl Freeze for DecodeResult
impl RefUnwindSafe for DecodeResult
impl Send for DecodeResult
impl Sync for DecodeResult
impl Unpin for DecodeResult
impl UnsafeUnpin for DecodeResult
impl UnwindSafe for DecodeResult
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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