pub struct VocabError {
pub code: ErrorCode,
pub token: Option<TokenId>,
pub detail: &'static str,
}Expand description
A structured vocabulary-boundary error.
Fields§
§code: ErrorCodeStable machine code (EmptyToken or MalformedTokenizer).
token: Option<TokenId>The offending token id, when one applies.
detail: &'static strAdvisory detail. Not the machine contract.
Implementations§
Source§impl VocabError
impl VocabError
Sourcepub fn empty_token() -> Self
pub fn empty_token() -> Self
An empty-byte token was rejected at the choke-point.
Sourcepub fn malformed_tokenizer(detail: &'static str) -> Self
pub fn malformed_tokenizer(detail: &'static str) -> Self
Tokenizer metadata (not a byte payload) was malformed.
Sourcepub fn malformed_tokenizer_for(token: TokenId, detail: &'static str) -> Self
pub fn malformed_tokenizer_for(token: TokenId, detail: &'static str) -> Self
Tokenizer metadata was malformed because of a specific, known token id.
Sourcepub fn limit_exceeded(detail: &'static str) -> Self
pub fn limit_exceeded(detail: &'static str) -> Self
A vocabulary resource cap was exceeded; the input is well-formed but too large.
Trait Implementations§
Source§impl Clone for VocabError
impl Clone for VocabError
Source§fn clone(&self) -> VocabError
fn clone(&self) -> VocabError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VocabError
impl Debug for VocabError
Source§impl Display for VocabError
impl Display for VocabError
impl Eq for VocabError
Source§impl Error for VocabError
impl Error for VocabError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl PartialEq for VocabError
impl PartialEq for VocabError
impl StructuralPartialEq for VocabError
Auto Trait Implementations§
impl Freeze for VocabError
impl RefUnwindSafe for VocabError
impl Send for VocabError
impl Sync for VocabError
impl Unpin for VocabError
impl UnsafeUnpin for VocabError
impl UnwindSafe for VocabError
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