pub struct InputStream<'buf> { /* private fields */ }

Implementations§

source§

impl<'buf> InputStream<'buf>

source

pub fn new(buf: &'buf [u8]) -> Self

source

pub fn len(&self) -> usize

Returns the length of currently readable subslice

source

pub fn is_empty(&self) -> bool

Whether the currently readable subslice is empty

source

pub fn limit(&mut self, limit: usize) -> Result<usize>

Limits the currently readable subslice, and returns previous limit

source

pub fn unlimit(&mut self, limit: usize)

Reverts previous slice limit

source

pub fn skip(&mut self, tag: u32) -> Result<()>

Skips next field with given tag

source

pub fn skip_until_tag(&mut self, next_tag: u32) -> Result<()>

Skip next set of values, until we find the provided tag. Used for traversing through groups

source

pub fn _varint<T: Varint>(&mut self) -> Result<T>

Decode a single varint from the stream. Currently we read it as u64, and then truncate.

source

pub fn _sigint<T: Sigint>(&mut self) -> Result<T>

Skip a single zigzag encoded varint from the stream

source

pub fn _fixed<T: Fixed>(&mut self) -> Result<T>

Read fixed values from the stream

source

pub fn _bytes(&mut self) -> Result<&'buf [u8]>

Read a length-prefixed slice from the stream

source

pub fn _string(&mut self) -> Result<&'buf str>

Read length-prefixed slice from the stream and decode it a string

source

pub fn varint<T: Varint>(&mut self, field: &mut T) -> Result<()>

source

pub fn sigint<T: Sigint + Default>(&mut self, field: &mut T) -> Result<()>

source

pub fn protoenum<T: From<u32>>(&mut self, field: &mut T) -> Result<()>

source

pub fn bool(&mut self, field: &mut bool) -> Result<()>

source

pub fn fixed32<T: Default + Fixed>(&mut self, field: &mut T) -> Result<()>

source

pub fn fixed64<T: Fixed>(&mut self, field: &mut T) -> Result<()>

source

pub fn bytes<'x, T: BytesLike<'buf>>(&mut self, field: &mut T) -> Result<()>

source

pub fn string<T: BytesLike<'buf>>(&mut self, field: &mut T) -> Result<()>

source

pub fn nested<P: BinProto<'buf>>(&mut self, p: &mut P) -> Result<()>

source

pub fn group<P: BinProto<'buf>>(&mut self, p: &mut P) -> Result<()>

source

pub fn _field_nested(&mut self, proto: &mut dyn BinProto<'buf>) -> Result<()>

source

pub fn _field_group( &mut self, _gtag: u32, proto: &mut dyn BinProto<'buf> ) -> Result<()>

Auto Trait Implementations§

§

impl<'buf> Freeze for InputStream<'buf>

§

impl<'buf> RefUnwindSafe for InputStream<'buf>

§

impl<'buf> Send for InputStream<'buf>

§

impl<'buf> Sync for InputStream<'buf>

§

impl<'buf> Unpin for InputStream<'buf>

§

impl<'buf> UnwindSafe for InputStream<'buf>

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.