pub struct Reader<'a> {
pub data: &'a [u8],
pub pos: usize,
}Fields§
§data: &'a [u8]§pos: usizeImplementations§
Source§impl<'a> Reader<'a>
impl<'a> Reader<'a>
pub fn new(data: &'a [u8]) -> Self
pub fn remaining(&self) -> &'a [u8] ⓘ
pub fn read_u8(&mut self) -> Result<u8, DecodeErr>
pub fn read_u32_le(&mut self) -> Result<u32, DecodeErr>
pub fn read_raw(&mut self, n: usize) -> Result<&'a [u8], DecodeErr>
Sourcepub fn read_compact_u32(&mut self) -> Result<u32, DecodeErr>
pub fn read_compact_u32(&mut self) -> Result<u32, DecodeErr>
SCALE compact integer (unsigned, up to u32 range).
Sourcepub fn read_string(&mut self) -> Result<String, DecodeErr>
pub fn read_string(&mut self) -> Result<String, DecodeErr>
SCALE string: compact length + UTF-8 bytes.
Sourcepub fn read_var_bytes(&mut self) -> Result<Vec<u8>, DecodeErr>
pub fn read_var_bytes(&mut self) -> Result<Vec<u8>, DecodeErr>
Dynamic-length bytes: compact length + raw bytes.
Auto Trait Implementations§
impl<'a> Freeze for Reader<'a>
impl<'a> RefUnwindSafe for Reader<'a>
impl<'a> Send for Reader<'a>
impl<'a> Sync for Reader<'a>
impl<'a> Unpin for Reader<'a>
impl<'a> UnsafeUnpin for Reader<'a>
impl<'a> UnwindSafe for Reader<'a>
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