pub enum InvalidColumn {
NonDecreasingOffsets,
TokenTooLarge,
MissingPadding,
CodeOutOfRange,
BadRowOffsets,
DecodedLenOverflow,
EmptyToken,
UnsortedTokens,
IncompleteAlphabet,
}Expand description
A violation found while validating compressed buffers.
Two kinds. Safety violations would let an unchecked decoder read or write
out of bounds — these are exactly the obligations an unsafe new_unchecked
caller must uphold to avoid UB. Conformance violations, including a
dictionary too large for the code address space, decode safely but make search /
tokenize give wrong answers. The validate family checks both, so a trusted
dictionary is fully conformant — indistinguishable from a trainer-built one.
Variants§
NonDecreasingOffsets
Dictionary offsets decrease (offsets[i] > offsets[i + 1]), which would
underflow the unchecked token-length subtraction.
TokenTooLarge
A dictionary token is longer than MAX_TOKEN_SIZE.
MissingPadding
A token offset has fewer than MAX_TOKEN_SIZE
readable bytes after it, so the decoder’s fixed-width read runs off the end.
CodeOutOfRange
The dictionary has more than 2^16 entries, or a code does not index the
dictionary (code >= num_tokens). In either case, the u16 token/code
type cannot address the requested entry.
BadRowOffsets
Row offsets are not non-decreasing, or the last exceeds the code count.
DecodedLenOverflow
The column’s tokens sum to more than usize::MAX decoded bytes, so the
decoded-length computation overflows and would under-size the output buffer.
EmptyToken
A dictionary token has zero length (offsets not strictly increasing).
UnsortedTokens
Dictionary tokens are not in strictly ascending bytewise order, so they are not sorted (binary search breaks) or not unique.
IncompleteAlphabet
The dictionary lacks one or more of the 256 single-byte tokens, so some inputs are not encodable.
Trait Implementations§
Source§impl Clone for InvalidColumn
impl Clone for InvalidColumn
Source§fn clone(&self) -> InvalidColumn
fn clone(&self) -> InvalidColumn
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for InvalidColumn
Source§impl Debug for InvalidColumn
impl Debug for InvalidColumn
Source§impl Display for InvalidColumn
impl Display for InvalidColumn
impl Eq for InvalidColumn
Source§impl Error for InvalidColumn
impl Error for InvalidColumn
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for InvalidColumn
impl PartialEq for InvalidColumn
impl StructuralPartialEq for InvalidColumn
Auto Trait Implementations§
impl Freeze for InvalidColumn
impl RefUnwindSafe for InvalidColumn
impl Send for InvalidColumn
impl Sync for InvalidColumn
impl Unpin for InvalidColumn
impl UnsafeUnpin for InvalidColumn
impl UnwindSafe for InvalidColumn
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.