pub trait BytecodeWrite<Id>where
Id: SiteId,{
type Error: Debug;
Show 14 methods
// Required methods
fn write_1bit(&mut self, data: u1) -> Result<(), Self::Error>;
fn write_2bits(&mut self, data: u2) -> Result<(), Self::Error>;
fn write_3bits(&mut self, data: u3) -> Result<(), Self::Error>;
fn write_4bits(&mut self, data: u4) -> Result<(), Self::Error>;
fn write_5bits(&mut self, data: u5) -> Result<(), Self::Error>;
fn write_6bits(&mut self, data: u6) -> Result<(), Self::Error>;
fn write_7bits(&mut self, data: u7) -> Result<(), Self::Error>;
fn write_byte(&mut self, data: u8) -> Result<(), Self::Error>;
fn write_word(&mut self, data: u16) -> Result<(), Self::Error>;
fn write_fixed<const LEN: usize>(
&mut self,
data: [u8; LEN],
) -> Result<(), Self::Error>;
fn write_bytes(&mut self, data: &[u8]) -> Result<(), Self::Error>;
fn write_ref(&mut self, id: Id) -> Result<(), Self::Error>;
fn check_aligned(&self);
// Provided method
fn write_bool(&mut self, data: bool) -> Result<(), Self::Error> { ... }
}
Expand description
Writer converting instructions into a bytecode.
Required Associated Types§
Required Methods§
Sourcefn write_fixed<const LEN: usize>(
&mut self,
data: [u8; LEN],
) -> Result<(), Self::Error>
fn write_fixed<const LEN: usize>( &mut self, data: [u8; LEN], ) -> Result<(), Self::Error>
Write data representable as a fixed-length byte array.
Sourcefn write_bytes(&mut self, data: &[u8]) -> Result<(), Self::Error>
fn write_bytes(&mut self, data: &[u8]) -> Result<(), Self::Error>
Write variable-length byte string.
Sourcefn check_aligned(&self)
fn check_aligned(&self)
Check if the current cursor position is aligned to the next byte.
§Panics
If the position is not aligned, panics.
Provided Methods§
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.