pub struct CorrectionStore { /* private fields */ }Expand description
Correction store - manages all corrections for an engram
Implementations§
Source§impl CorrectionStore
impl CorrectionStore
Sourcepub fn add(&mut self, chunk_id: u64, original: &[u8], approximation: &[u8])
pub fn add(&mut self, chunk_id: u64, original: &[u8], approximation: &[u8])
Add a correction for a chunk
Sourcepub fn get(&self, chunk_id: u64) -> Option<&ChunkCorrection>
pub fn get(&self, chunk_id: u64) -> Option<&ChunkCorrection>
Get correction for a chunk
Sourcepub fn apply(&self, chunk_id: u64, approximation: &[u8]) -> Option<Vec<u8>>
pub fn apply(&self, chunk_id: u64, approximation: &[u8]) -> Option<Vec<u8>>
Apply correction to approximation
Sourcepub fn stats(&self) -> CorrectionStats
pub fn stats(&self) -> CorrectionStats
Get correction statistics
Sourcepub fn from_bytes(bytes: &[u8]) -> Option<Self>
pub fn from_bytes(bytes: &[u8]) -> Option<Self>
Deserialize from bytes
Trait Implementations§
Source§impl Clone for CorrectionStore
impl Clone for CorrectionStore
Source§fn clone(&self) -> CorrectionStore
fn clone(&self) -> CorrectionStore
Returns a duplicate of the value. Read more
1.0.0 · 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 CorrectionStore
impl Debug for CorrectionStore
Source§impl Default for CorrectionStore
impl Default for CorrectionStore
Source§fn default() -> CorrectionStore
fn default() -> CorrectionStore
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for CorrectionStore
impl<'de> Deserialize<'de> for CorrectionStore
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CorrectionStore
impl RefUnwindSafe for CorrectionStore
impl Send for CorrectionStore
impl Sync for CorrectionStore
impl Unpin for CorrectionStore
impl UnwindSafe for CorrectionStore
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