ra_ap_rustc_serialize::opaque

Struct MemDecoder

Source
pub struct MemDecoder<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> MemDecoder<'a>

Source

pub fn new(data: &'a [u8], position: usize) -> Result<MemDecoder<'a>, ()>

Source

pub fn split_at(&self, position: usize) -> MemDecoder<'a>

Source

pub fn len(&self) -> usize

Source

pub fn remaining(&self) -> usize

Source

pub fn read_array<const N: usize>(&mut self) -> [u8; N]

Source

pub fn with_position<F, T>(&mut self, pos: usize, func: F) -> T
where F: Fn(&mut MemDecoder<'a>) -> T,

While we could manually expose manipulation of the decoder position, all current users of that method would need to reset the position later, incurring the bounds check of set_position twice.

Trait Implementations§

Source§

impl<'a> Decodable<MemDecoder<'a>> for IntEncodedWithFixedSize

Source§

impl<'a> Decodable<MemDecoder<'a>> for Vec<u8>

Source§

fn decode(d: &mut MemDecoder<'a>) -> Self

Source§

impl<'a> Decoder for MemDecoder<'a>

Source§

fn read_usize(&mut self) -> usize

Source§

fn read_u128(&mut self) -> u128

Source§

fn read_u64(&mut self) -> u64

Source§

fn read_u32(&mut self) -> u32

Source§

fn read_u16(&mut self) -> u16

Source§

fn read_u8(&mut self) -> u8

Source§

fn read_isize(&mut self) -> isize

Source§

fn read_i128(&mut self) -> i128

Source§

fn read_i64(&mut self) -> i64

Source§

fn read_i32(&mut self) -> i32

Source§

fn read_i16(&mut self) -> i16

Source§

fn read_raw_bytes(&mut self, bytes: usize) -> &'a [u8]

Source§

fn peek_byte(&self) -> u8

Source§

fn position(&self) -> usize

Source§

fn read_i8(&mut self) -> i8

Source§

fn read_bool(&mut self) -> bool

Source§

fn read_char(&mut self) -> char

Source§

fn read_str(&mut self) -> &str

Auto Trait Implementations§

§

impl<'a> Freeze for MemDecoder<'a>

§

impl<'a> RefUnwindSafe for MemDecoder<'a>

§

impl<'a> !Send for MemDecoder<'a>

§

impl<'a> !Sync for MemDecoder<'a>

§

impl<'a> Unpin for MemDecoder<'a>

§

impl<'a> UnwindSafe for MemDecoder<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.