pub struct Dictionary {
pub id: u32,
pub data: Vec<u8>,
}Expand description
In-memory dictionary.
Fields§
§id: u32Stable id (CRC of content by default).
data: Vec<u8>Dictionary bytes (prepended as virtual history for match finding).
Implementations§
Source§impl Dictionary
impl Dictionary
Sourcepub fn from_bytes(data: Vec<u8>) -> Result<Self>
pub fn from_bytes(data: Vec<u8>) -> Result<Self>
Create from raw bytes; id = CRC32 of content (non-zero).
Sourcepub fn train_cover(samples: &[&[u8]], max_size: usize) -> Result<Self>
pub fn train_cover(samples: &[&[u8]], max_size: usize) -> Result<Self>
COVER-style training (recommended). See crate::core::cover::train_cover.
Sourcepub fn train_simple(samples: &[&[u8]], max_size: usize) -> Result<Self>
pub fn train_simple(samples: &[&[u8]], max_size: usize) -> Result<Self>
Naive train: concatenate sample tails into a dict of max_size.
Prefer [train_cover] for better dictionaries on structured protocols.
Trait Implementations§
Source§impl Clone for Dictionary
impl Clone for Dictionary
Auto Trait Implementations§
impl Freeze for Dictionary
impl RefUnwindSafe for Dictionary
impl Send for Dictionary
impl Sync for Dictionary
impl Unpin for Dictionary
impl UnsafeUnpin for Dictionary
impl UnwindSafe for Dictionary
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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