pub struct Encoder {
pub low: u64,
pub range: u32,
/* private fields */
}Expand description
The binary range encoder.
Fields§
§low: u64The low bound of the current interval.
range: u32The size of the current interval.
Implementations§
Source§impl Encoder
impl Encoder
Sourcepub fn set_stream(&mut self, stream: Vec<u8>)
pub fn set_stream(&mut self, stream: Vec<u8>)
Replaces the output buffer.
Sourcepub fn release_stream(&mut self) -> Vec<u8> ⓘ
pub fn release_stream(&mut self) -> Vec<u8> ⓘ
Takes the output buffer out of the encoder.
Sourcepub fn stream_mut(&mut self) -> &mut Vec<u8> ⓘ
pub fn stream_mut(&mut self) -> &mut Vec<u8> ⓘ
The bytes written so far, mutably.
Sourcepub fn flush_data(&mut self)
pub fn flush_data(&mut self)
Flushes the pending low bytes.
Sourcepub fn flush_stream(&mut self)
pub fn flush_stream(&mut self)
Flushes the output stream.
Does nothing, since a Vec<u8> has nothing to flush.
Sourcepub fn close_stream(&mut self)
pub fn close_stream(&mut self)
Closes the output stream.
Drops the output buffer.
Sourcepub fn encode(&mut self, start: u32, size: u32, total: u32)
pub fn encode(&mut self, start: u32, size: u32, total: u32)
Encodes a symbol that occupies size of total probability units.
Sourcepub fn shift_low(&mut self)
pub fn shift_low(&mut self)
Shifts the low accumulator by one byte, emitting the pending bytes.
Sourcepub fn encode_direct_bits(&mut self, v: u32, num_total_bits: i32)
pub fn encode_direct_bits(&mut self, v: u32, num_total_bits: i32)
Encodes num_total_bits bits of v without a probability model.
Sourcepub fn encode_bit(&mut self, size0: u32, num_total_bits: i32, symbol: u32)
pub fn encode_bit(&mut self, size0: u32, num_total_bits: i32, symbol: u32)
Encodes a single bit using a probability model of num_total_bits bits.
Sourcepub fn get_processed_size_add(&self) -> i64
pub fn get_processed_size_add(&self) -> i64
The number of bytes produced so far, plus the four bytes that the decoder needs to finish the stream.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Encoder
impl RefUnwindSafe for Encoder
impl Send for Encoder
impl Sync for Encoder
impl Unpin for Encoder
impl UnsafeUnpin for Encoder
impl UnwindSafe for Encoder
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