Struct serde_amqp::read::SliceReader

source ·
pub struct SliceReader<'s> { /* private fields */ }
Expand description

A reader for a slice of bytes

Implementations§

source§

impl<'s> SliceReader<'s>

source

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

Creates a new slice reader

source

pub fn get_byte_slice(&mut self, n: usize) -> Result<&'s [u8], Error>

Return a slice of the given length. If the internal slice doesn’t have enough bytes, an Err(_) will be returned.

Trait Implementations§

source§

impl<'s> Debug for SliceReader<'s>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'s> Read<'s> for SliceReader<'s>

source§

fn peek(&mut self) -> Option<u8>

Peek the next byte without consuming
source§

fn peek_bytes(&mut self, n: usize) -> Option<&[u8]>

Peek n number of bytes without consuming
source§

fn next(&mut self) -> Option<u8>

Read the next byte
source§

fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>

Read to buffer
source§

fn forward_read_bytes<V>( &mut self, len: usize, visitor: V, ) -> Result<V::Value, Error>
where V: Visitor<'s>,

Forward bytes to visitor
source§

fn forward_read_str<V>( &mut self, len: usize, visitor: V, ) -> Result<V::Value, Error>
where V: Visitor<'s>,

Forward str to visitor
source§

fn read_const_bytes<const N: usize>(&mut self) -> Option<[u8; N]>

Read n bytes Read more
source§

fn read_bytes(&mut self, n: usize) -> Option<Vec<u8>>

Consuming n number of bytes

Auto Trait Implementations§

§

impl<'s> Freeze for SliceReader<'s>

§

impl<'s> RefUnwindSafe for SliceReader<'s>

§

impl<'s> Send for SliceReader<'s>

§

impl<'s> Sync for SliceReader<'s>

§

impl<'s> Unpin for SliceReader<'s>

§

impl<'s> UnwindSafe for SliceReader<'s>

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.