Struct ParserMut

Source
pub struct ParserMut<'a> {
    pub bytes: &'a mut [u8],
}
Expand description

A parser that can return mutable references to the data that it parses.

Most of the methods defined on ParserMut are equivalent to the same methods on Parser.

Fields§

§bytes: &'a mut [u8]

The remaining, unparsed data.

Implementations§

Source§

impl<'a> ParserMut<'a>

Source

pub fn new(bytes: &'a mut [u8]) -> Self

Source

pub fn peek_rest(&self) -> &[u8]

Source

pub fn peek_rest_mut(&mut self) -> &mut [u8]

Source

pub fn into_rest(self) -> &'a mut [u8]

Source

pub fn is_empty(&self) -> bool

Source

pub fn len(&self) -> usize

Source

pub fn skip(&mut self, n: usize) -> Result<(), ParserError>

Source

pub fn bytes(&mut self, n: usize) -> Result<&'a [u8], ParserError>

Source

pub fn bytes_mut(&mut self, n: usize) -> Result<&'a mut [u8], ParserError>

Source

pub fn get<T: FromBytes + Unaligned + Immutable + KnownLayout>( &mut self, ) -> Result<&'a T, ParserError>

Source

pub fn get_mut<T: FromBytes + IntoBytes + Unaligned + Immutable + KnownLayout>( &mut self, ) -> Result<&'a mut T, ParserError>

Source

pub fn copy<T: FromBytes + Unaligned + Immutable>( &mut self, ) -> Result<T, ParserError>

Source

pub fn slice_mut<T: FromBytes + IntoBytes + Unaligned>( &mut self, len: usize, ) -> Result<&'a mut [T], ParserError>

Source

pub fn array<const N: usize>(&mut self) -> Result<[u8; N], ParserError>

Source

pub fn u8(&mut self) -> Result<u8, ParserError>

Source

pub fn i8(&mut self) -> Result<i8, ParserError>

Source

pub fn i16(&mut self) -> Result<i16, ParserError>

Source

pub fn i32(&mut self) -> Result<i32, ParserError>

Source

pub fn i64(&mut self) -> Result<i64, ParserError>

Source

pub fn u16(&mut self) -> Result<u16, ParserError>

Source

pub fn u32(&mut self) -> Result<u32, ParserError>

Source

pub fn u64(&mut self) -> Result<u64, ParserError>

Source

pub fn skip_strz(&mut self) -> Result<(), ParserError>

Source

pub fn strz(&mut self) -> Result<&'a mut BStr, ParserError>

Source

pub fn type_index(&mut self) -> Result<TypeIndex, ParserError>

Source

pub fn skip_number(&mut self) -> Result<(), ParserError>

Auto Trait Implementations§

§

impl<'a> Freeze for ParserMut<'a>

§

impl<'a> RefUnwindSafe for ParserMut<'a>

§

impl<'a> Send for ParserMut<'a>

§

impl<'a> Sync for ParserMut<'a>

§

impl<'a> Unpin for ParserMut<'a>

§

impl<'a> !UnwindSafe for ParserMut<'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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more