Struct rustc_serialize::opaque::MemDecoder

source ·
pub struct MemDecoder<'a> {
    start: *const u8,
    current: *const u8,
    end: *const u8,
    _marker: PhantomData<&'a u8>,
}

Fields§

§start: *const u8§current: *const u8§end: *const u8§_marker: PhantomData<&'a u8>

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

fn decoder_exhausted() -> !

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>,

§

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>,

§

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.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 24 bytes