Struct bt_bencode::read::SliceRead

source ·
pub struct SliceRead<'a> { /* private fields */ }
Expand description

A wrapper to implement this crate’s Read trait for byte slices.

Implementations§

source§

impl<'a> SliceRead<'a>

source

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

Instantiates a new reader.

Trait Implementations§

source§

impl<'a> Debug for SliceRead<'a>

source§

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

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

impl<'a> Read<'a> for SliceRead<'a>

source§

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

Consumes and returns the next read byte.
source§

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

Returns the next byte but does not consume. Read more
source§

fn byte_offset(&self) -> usize

Returns the position in the stream of bytes.
source§

fn parse_byte_str<'b>( &'b mut self, _buf: &'b mut Vec<u8> ) -> Result<Ref<'a, 'b, [u8]>>

Returns the next slice of data for the given length. Read more
source§

fn parse_raw_integer<'b>( &'b mut self, _buf: &'b mut Vec<u8> ) -> Result<Ref<'a, 'b, [u8]>>

Consumes and returns the next integer raw encoding. Read more
source§

fn parse_raw_byte_str<'b>( &mut self, _buf: &'b mut Vec<u8> ) -> Result<Ref<'a, 'b, [u8]>>

Consumes and returns the next byte string raw encoding. Read more
source§

fn parse_raw_list<'b>( &'b mut self, buf: &'b mut Vec<u8> ) -> Result<Ref<'a, 'b, [u8]>>

Consumes and returns the next list raw encoding. Read more
source§

fn parse_raw_dict<'b>( &'b mut self, buf: &'b mut Vec<u8> ) -> Result<Ref<'a, 'b, [u8]>>

Consumes and returns the next dictionary raw encoding. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for SliceRead<'a>

§

impl<'a> RefUnwindSafe for SliceRead<'a>

§

impl<'a> Send for SliceRead<'a>

§

impl<'a> Sync for SliceRead<'a>

§

impl<'a> Unpin for SliceRead<'a>

§

impl<'a> UnwindSafe for SliceRead<'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, 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.