pub struct Marshaller<'a, C, D>{ /* private fields */ }Expand description
Marshals instructions to and from bytecode representation.
Implementations§
Source§impl<'a, C, D> Marshaller<'a, C, D>
impl<'a, C, D> Marshaller<'a, C, D>
Trait Implementations§
Source§impl<'a, C, D> BytecodeRead<LibId> for Marshaller<'a, C, D>
impl<'a, C, D> BytecodeRead<LibId> for Marshaller<'a, C, D>
Source§fn pos(&self) -> u16
fn pos(&self) -> u16
Return the current byte offset of the cursor. Does not account for bits.
If the position is exactly at EOF, returns
None.Source§fn seek(&mut self, byte_pos: u16) -> Result<u16, CodeEofError>
fn seek(&mut self, byte_pos: u16) -> Result<u16, CodeEofError>
Set the current cursor byte offset to the provided value if it is less than the underlying
buffer length. Read more
Source§fn read_2bits(&mut self) -> Result<u2, CodeEofError>
fn read_2bits(&mut self) -> Result<u2, CodeEofError>
Read two bits.
Source§fn read_3bits(&mut self) -> Result<u3, CodeEofError>
fn read_3bits(&mut self) -> Result<u3, CodeEofError>
Read three bits.
Source§fn read_4bits(&mut self) -> Result<u4, CodeEofError>
fn read_4bits(&mut self) -> Result<u4, CodeEofError>
Read four bits.
Source§fn read_5bits(&mut self) -> Result<u5, CodeEofError>
fn read_5bits(&mut self) -> Result<u5, CodeEofError>
Read five bits.
Source§fn read_6bits(&mut self) -> Result<u6, CodeEofError>
fn read_6bits(&mut self) -> Result<u6, CodeEofError>
Read six bits.
Source§fn read_7bits(&mut self) -> Result<u7, CodeEofError>
fn read_7bits(&mut self) -> Result<u7, CodeEofError>
Read seven bits.
Source§fn read_fixed<N, const LEN: usize>(
&mut self,
f: impl FnOnce([u8; LEN]) -> N,
) -> Result<N, CodeEofError>
fn read_fixed<N, const LEN: usize>( &mut self, f: impl FnOnce([u8; LEN]) -> N, ) -> Result<N, CodeEofError>
Read the fixed number of bytes and convert it into a result type. Read more
Source§fn read_bytes(&mut self) -> Result<(SmallBlob, bool), CodeEofError>
fn read_bytes(&mut self) -> Result<(SmallBlob, bool), CodeEofError>
Read variable-length byte string. Read more
Source§fn check_aligned(&self)
fn check_aligned(&self)
Check if the current cursor position is aligned to the next byte. Read more
Source§impl<'a, C, D> BytecodeWrite<LibId> for Marshaller<'a, C, D>
impl<'a, C, D> BytecodeWrite<LibId> for Marshaller<'a, C, D>
Source§type Error = MarshallError
type Error = MarshallError
Error type returned during writing procedures.
Source§fn write_1bit(&mut self, data: u1) -> Result<(), MarshallError>
fn write_1bit(&mut self, data: u1) -> Result<(), MarshallError>
Write a single bit.
Source§fn write_2bits(&mut self, data: u2) -> Result<(), MarshallError>
fn write_2bits(&mut self, data: u2) -> Result<(), MarshallError>
Write two bits.
Source§fn write_3bits(&mut self, data: u3) -> Result<(), MarshallError>
fn write_3bits(&mut self, data: u3) -> Result<(), MarshallError>
Write three bits.
Source§fn write_4bits(&mut self, data: u4) -> Result<(), MarshallError>
fn write_4bits(&mut self, data: u4) -> Result<(), MarshallError>
Write four bits.
Source§fn write_5bits(&mut self, data: u5) -> Result<(), MarshallError>
fn write_5bits(&mut self, data: u5) -> Result<(), MarshallError>
Write five bits.
Source§fn write_6bits(&mut self, data: u6) -> Result<(), MarshallError>
fn write_6bits(&mut self, data: u6) -> Result<(), MarshallError>
Write six bits.
Source§fn write_7bits(&mut self, data: u7) -> Result<(), MarshallError>
fn write_7bits(&mut self, data: u7) -> Result<(), MarshallError>
Write seven bits.
Source§fn write_byte(&mut self, data: u8) -> Result<(), MarshallError>
fn write_byte(&mut self, data: u8) -> Result<(), MarshallError>
Write byte.
Source§fn write_word(&mut self, data: u16) -> Result<(), MarshallError>
fn write_word(&mut self, data: u16) -> Result<(), MarshallError>
Write word.
Source§fn 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.
Source§fn write_bytes(&mut self, data: &[u8]) -> Result<(), Self::Error>
fn write_bytes(&mut self, data: &[u8]) -> Result<(), Self::Error>
Write variable-length byte string.
Source§fn check_aligned(&self)
fn check_aligned(&self)
Check if the current cursor position is aligned to the next byte. Read more
Auto Trait Implementations§
impl<'a, C, D> Freeze for Marshaller<'a, C, D>
impl<'a, C, D> RefUnwindSafe for Marshaller<'a, C, D>where
C: RefUnwindSafe,
D: RefUnwindSafe,
impl<'a, C, D> Send for Marshaller<'a, C, D>
impl<'a, C, D> Sync for Marshaller<'a, C, D>
impl<'a, C, D> Unpin for Marshaller<'a, C, D>
impl<'a, C, D> UnwindSafe for Marshaller<'a, C, D>where
C: UnwindSafe,
D: UnwindSafe,
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