Struct protokit_binformat::stream::InputStream
source · pub struct InputStream<'buf> { /* private fields */ }
Implementations§
source§impl<'buf> InputStream<'buf>
impl<'buf> InputStream<'buf>
pub fn new(buf: &'buf [u8]) -> Self
sourcepub fn limit(&mut self, limit: usize) -> Result<usize>
pub fn limit(&mut self, limit: usize) -> Result<usize>
Limits the currently readable subslice, and returns previous limit
sourcepub fn skip_until_tag(&mut self, next_tag: u32) -> Result<()>
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
sourcepub fn _varint<T: Varint>(&mut self) -> Result<T>
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.
sourcepub fn _sigint<T: Sigint>(&mut self) -> Result<T>
pub fn _sigint<T: Sigint>(&mut self) -> Result<T>
Skip a single zigzag encoded varint from the stream
sourcepub fn _string(&mut self) -> Result<&'buf str>
pub fn _string(&mut self) -> Result<&'buf str>
Read length-prefixed slice from the stream and decode it a string
pub fn varint<T: Varint>(&mut self, field: &mut T) -> Result<()>
pub fn sigint<T: Sigint + Default>(&mut self, field: &mut T) -> Result<()>
pub fn protoenum<T: From<u32>>(&mut self, field: &mut T) -> Result<()>
pub fn bool(&mut self, field: &mut bool) -> Result<()>
pub fn fixed32<T: Default + Fixed>(&mut self, field: &mut T) -> Result<()>
pub fn fixed64<T: Fixed>(&mut self, field: &mut T) -> Result<()>
pub fn bytes<'x, T: BytesLike<'buf>>(&mut self, field: &mut T) -> Result<()>
pub fn string<T: BytesLike<'buf>>(&mut self, field: &mut T) -> Result<()>
pub fn nested<P: BinProto<'buf>>(&mut self, p: &mut P) -> Result<()>
pub fn group<P: BinProto<'buf>>(&mut self, p: &mut P) -> Result<()>
pub fn _field_nested(&mut self, proto: &mut dyn BinProto<'buf>) -> Result<()>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more