pub struct DedupeDecoder { /* private fields */ }Expand description
Companion to DedupeEncoder that reconstructs repeated values from IDs.
Implementations§
Source§impl DedupeDecoder
impl DedupeDecoder
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new DedupeDecoder with the specified capacity.
The decoder will be able to hold at least capacity cached values without
reallocating. Creates a decoder with a pre‑allocated value table of capacity.
Sourcepub fn decode<T: Pack + Clone + Hash + Eq + Send + Sync + 'static>(
&mut self,
reader: &mut impl Read,
) -> Result<T>
pub fn decode<T: Pack + Clone + Hash + Eq + Send + Sync + 'static>( &mut self, reader: &mut impl Read, ) -> Result<T>
Decodes a value with deduplication.
If the ID is 0, a new value is decoded and stored in the table. Otherwise, the value is retrieved from the table using the given ID.
§Arguments
reader- The reader from which the encoded data will be read.
§Returns
The decoded value. Decodes a value with deduplication support.
If the next ID is 0, a fresh value is decoded, stored, and returned. Otherwise, the
referenced value is loaded from the cache.
Trait Implementations§
Source§impl Default for DedupeDecoder
impl Default for DedupeDecoder
Source§fn default() -> DedupeDecoder
fn default() -> DedupeDecoder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DedupeDecoder
impl !RefUnwindSafe for DedupeDecoder
impl Send for DedupeDecoder
impl Sync for DedupeDecoder
impl Unpin for DedupeDecoder
impl !UnwindSafe for DedupeDecoder
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