#[non_exhaustive]pub enum TrainingError {
Parameter,
Samples,
DictionaryTooSmall,
}Available on crate feature
dict-builder only.Expand description
Why a segment trainer or the finalizer refused its input. It rides inside
the InvalidInput error returned; TrainingError::of reads it back.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Parameter
A training parameter lies outside its range.
Samples
The samples cannot be trained on: none, too few, or too few or too many bytes.
DictionaryTooSmall
The dictionary asked for is smaller than
MIN_TRAINED_DICT_SIZE.
Implementations§
Source§impl TrainingError
impl TrainingError
Sourcepub fn of(error: &Error) -> Option<Self>
pub fn of(error: &Error) -> Option<Self>
The cause carried by an error a trainer returned, or None for one it
did not raise itself (a failed read, write or allocation).
§Examples
use structured_zstd::dictionary::{
CoverOptions, FinalizeOptions, TrainingError, train_cover_dict,
};
let options = CoverOptions { k: 64, d: 8, ..CoverOptions::default() };
let err = train_cover_dict(&[0; 64], &[64], 100, &options, FinalizeOptions::default())
.unwrap_err();
assert_eq!(TrainingError::of(&err), Some(TrainingError::DictionaryTooSmall));Trait Implementations§
Source§impl Clone for TrainingError
impl Clone for TrainingError
impl Copy for TrainingError
Source§impl Debug for TrainingError
impl Debug for TrainingError
impl Eq for TrainingError
Source§impl PartialEq for TrainingError
impl PartialEq for TrainingError
impl StructuralPartialEq for TrainingError
Auto Trait Implementations§
impl Freeze for TrainingError
impl RefUnwindSafe for TrainingError
impl Send for TrainingError
impl Sync for TrainingError
impl Unpin for TrainingError
impl UnsafeUnpin for TrainingError
impl UnwindSafe for TrainingError
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