pub trait WriteExt: Write {
// Provided methods
fn emit_u8(&mut self, v: u8) -> Result<(), Error> { ... }
fn emit_u16(&mut self, v: u16) -> Result<(), Error> { ... }
fn emit_u32(&mut self, v: u32) -> Result<(), Error> { ... }
fn emit_u64(&mut self, v: u64) -> Result<(), Error> { ... }
fn emit_slice(&mut self, slice: &[u8]) -> Result<(), Error> { ... }
fn emit_compact_size(
&mut self,
value: impl Into<u64>,
) -> Result<usize, Error> { ... }
}Expand description
Utility trait to write some primitive values into our encoding format.
Provided Methods§
Sourcefn emit_u8(&mut self, v: u8) -> Result<(), Error>
fn emit_u8(&mut self, v: u8) -> Result<(), Error>
Write an 8-bit unsigned integer in little-endian.
Sourcefn emit_u16(&mut self, v: u16) -> Result<(), Error>
fn emit_u16(&mut self, v: u16) -> Result<(), Error>
Write a 16-bit unsigned integer in little-endian.
Sourcefn emit_u32(&mut self, v: u32) -> Result<(), Error>
fn emit_u32(&mut self, v: u32) -> Result<(), Error>
Write a 32-bit unsigned integer in little-endian.
Sourcefn emit_u64(&mut self, v: u64) -> Result<(), Error>
fn emit_u64(&mut self, v: u64) -> Result<(), Error>
Write a 64-bit unsigned integer in little-endian.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.