pub struct RansEncoder { /* private fields */ }Expand description
A symbol-at-a-time rANS encoder.
Feed symbols with put (in reverse message order – this is
inherent to rANS), then call finish to obtain the byte stream.
The same byte stream is decodable by RansDecoder or decode.
Implementations§
Source§impl RansEncoder
impl RansEncoder
Sourcepub fn with_capacity(cap: usize) -> Self
pub fn with_capacity(cap: usize) -> Self
Create a new encoder with pre-allocated buffer capacity.
Sourcepub fn put(&mut self, sym: u32, table: &FrequencyTable) -> Result<(), AnsError>
pub fn put(&mut self, sym: u32, table: &FrequencyTable) -> Result<(), AnsError>
Encode a single symbol into the rANS state.
Symbols must be fed in reverse message order. If the original message is
[A, B, C], call put(C), put(B), put(A).
Trait Implementations§
Source§impl Clone for RansEncoder
impl Clone for RansEncoder
Source§fn clone(&self) -> RansEncoder
fn clone(&self) -> RansEncoder
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 RansEncoder
impl Debug for RansEncoder
Auto Trait Implementations§
impl Freeze for RansEncoder
impl RefUnwindSafe for RansEncoder
impl Send for RansEncoder
impl Sync for RansEncoder
impl Unpin for RansEncoder
impl UnsafeUnpin for RansEncoder
impl UnwindSafe for RansEncoder
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