Struct cardano_serialization_lib::chain_core::mempack::ReadBuf
source · pub struct ReadBuf<'a> { /* private fields */ }
Expand description
A local memory slice to read from memory
Implementations§
source§impl<'a> ReadBuf<'a>
impl<'a> ReadBuf<'a>
pub fn position(&self) -> usize
sourcepub fn expect_end(&mut self) -> Result<(), ReadError>
pub fn expect_end(&mut self) -> Result<(), ReadError>
Check if everything has been properly consumed
sourcepub fn skip_bytes(&mut self, sz: usize) -> Result<(), ReadError>
pub fn skip_bytes(&mut self, sz: usize) -> Result<(), ReadError>
Skip a number of bytes from the buffer.
sourcepub fn get_slice(&mut self, sz: usize) -> Result<&'a [u8], ReadError>
pub fn get_slice(&mut self, sz: usize) -> Result<&'a [u8], ReadError>
Return a slice of the next bytes from the buffer
pub fn get_slice_end(&mut self) -> &'a [u8] ⓘ
pub fn into_slice_mut(&mut self, slice: &mut [u8]) -> Result<(), ReadError>
sourcepub fn split_to(&mut self, sz: usize) -> Result<ReadBuf<'a>, ReadError>
pub fn split_to(&mut self, sz: usize) -> Result<ReadBuf<'a>, ReadError>
Return a sub-buffer ending at the given byte offset
sourcepub fn peek_u8(&mut self) -> Result<u8, ReadError>
pub fn peek_u8(&mut self) -> Result<u8, ReadError>
Peek at the next u8 from the buffer. the cursor is not advanced to the next byte.