pub struct AnsEncoder { /* private fields */ }Expand description
ANS encoder state.
Implementations§
Source§impl AnsEncoder
impl AnsEncoder
Sourcepub fn with_capacity(num_tokens: usize) -> Self
pub fn with_capacity(num_tokens: usize) -> Self
Creates a new ANS encoder with pre-allocated capacity for num_tokens tokens.
Sourcepub fn put_symbol(&mut self, info: &AnsEncSymbolInfo)
pub fn put_symbol(&mut self, info: &AnsEncSymbolInfo)
Encodes a single symbol using precomputed symbol info.
Returns the bits that should be output (if any).
Sourcepub fn push_bits(&mut self, bits: u32, nbits: u8)
pub fn push_bits(&mut self, bits: u32, nbits: u8)
Pushes extra bits into the encoder’s output buffer.
Used for HybridUint extra bits that are interleaved with ANS symbols. These bits are stored in the same reversed buffer and will be emitted in proper order during finalize().
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AnsEncoder
impl RefUnwindSafe for AnsEncoder
impl Send for AnsEncoder
impl Sync for AnsEncoder
impl Unpin for AnsEncoder
impl UnsafeUnpin for AnsEncoder
impl UnwindSafe for AnsEncoder
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> 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