rustc_serialize::opaque

Struct 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize = _

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.

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