pub struct EncoderBuffer { /* private fields */ }encoder only.Expand description
Output buffer for writing Draco bitstream data.
EncoderBuffer accumulates encoded bytes and supports both byte-aligned
writes and packed bit-level encoding for entropy-coded sections. Encoders
write into it; after encoding, data returns the
finished bitstream as a byte slice ready to hand to a DecoderBuffer or
write to a file.
Implementations§
Source§impl EncoderBuffer
impl EncoderBuffer
Sourcepub fn set_version(&mut self, major: u8, minor: u8)
pub fn set_version(&mut self, major: u8, minor: u8)
Sets the target Draco bitstream version.
Sourcepub fn version_major(&self) -> u8
pub fn version_major(&self) -> u8
Returns the target major bitstream version.
Sourcepub fn version_minor(&self) -> u8
pub fn version_minor(&self) -> u8
Returns the target minor bitstream version.
Sourcepub fn bitstream_version(&self) -> u16
pub fn bitstream_version(&self) -> u16
Returns the packed 0xMMmm target bitstream version for ordered comparisons.
Sourcepub fn start_bit_encoding(
&mut self,
required_bits: usize,
encode_size: bool,
) -> bool
pub fn start_bit_encoding( &mut self, required_bits: usize, encode_size: bool, ) -> bool
Starts writing a packed bit sequence.
Sourcepub fn end_bit_encoding(&mut self)
pub fn end_bit_encoding(&mut self)
Finishes the active packed bit sequence.
Sourcepub fn encode_least_significant_bits32(
&mut self,
nbits: u32,
value: u32,
) -> bool
pub fn encode_least_significant_bits32( &mut self, nbits: u32, value: u32, ) -> bool
Writes the least significant nbits bits of a 32-bit value.
Sourcepub fn encode<T: NoUninit>(&mut self, data: T) -> bool
pub fn encode<T: NoUninit>(&mut self, data: T) -> bool
Appends a plain-old-data value in native memory representation.
Sourcepub fn encode_data(&mut self, data: &[u8]) -> bool
pub fn encode_data(&mut self, data: &[u8]) -> bool
Appends raw bytes.
Sourcepub fn encode_u16(&mut self, val: u16)
pub fn encode_u16(&mut self, val: u16)
Appends a little-endian u16.
Sourcepub fn encode_u32(&mut self, val: u32)
pub fn encode_u32(&mut self, val: u32)
Appends a little-endian u32.
Sourcepub fn encode_u64(&mut self, val: u64)
pub fn encode_u64(&mut self, val: u64)
Appends a little-endian u64.
Sourcepub fn encode_varint<T: Into<u64>>(&mut self, val: T)
pub fn encode_varint<T: Into<u64>>(&mut self, val: T)
Appends an unsigned LEB128-style Draco varint.
Sourcepub fn encode_varint_signed_i32(&mut self, val: i32)
pub fn encode_varint_signed_i32(&mut self, val: i32)
Draco-compatible signed varint (ConvertSignedIntToSymbol + unsigned varint).