Trait bitcode_lightyear_patch::write::Write
source · pub trait Write {
// Required methods
fn write_bit(&mut self, v: bool);
fn write_bits(&mut self, word: Word, bits: usize);
fn write_bytes(&mut self, bytes: &[u8]);
fn num_bits_written(&self) -> usize;
// Provided methods
fn write_false(&mut self) { ... }
fn write_zeros(&mut self, bits: usize) { ... }
}Expand description
Abstracts over writing bits to a buffer.
Required Methods§
sourcefn write_bit(&mut self, v: bool)
fn write_bit(&mut self, v: bool)
Writes a bit. If v is always false use Self::write_false.
sourcefn write_bits(&mut self, word: Word, bits: usize)
fn write_bits(&mut self, word: Word, bits: usize)
Writes up to 64 bits. The index of word’s most significant 1 must be < bits.
bits must be in range 0..=64.
sourcefn write_bytes(&mut self, bytes: &[u8])
fn write_bytes(&mut self, bytes: &[u8])
Writes bytes.
sourcefn num_bits_written(&self) -> usize
fn num_bits_written(&self) -> usize
Number of bits that were written to the Writer
Provided Methods§
sourcefn write_false(&mut self)
fn write_false(&mut self)
Writes false. Might be faster than writer.write_bit(false).
sourcefn write_zeros(&mut self, bits: usize)
fn write_zeros(&mut self, bits: usize)
Writes up to 64 zero bits. Might be faster than writer.write_bits(0, bits).