Struct bitcoin_io::Take

source ·
pub struct Take<'a, R: Read + ?Sized> { /* private fields */ }
Expand description

Reader adapter which limits the bytes read from an underlying reader.

Created by calling [Read::take].

Implementations§

source§

impl<'a, R: Read + ?Sized> Take<'a, R>

source

pub fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>

Reads all bytes until EOF from the underlying reader into buf.

Trait Implementations§

source§

impl<'a, R: BufRead + ?Sized> BufRead for Take<'a, R>

source§

fn fill_buf(&mut self) -> Result<&[u8]>

Returns data read from this reader, filling the internal buffer if needed.
source§

fn consume(&mut self, amount: usize)

Marks the buffered data up to amount as consumed. Read more
source§

impl<'a, R: Read + ?Sized> Read for Take<'a, R>

source§

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

Reads bytes from source into buf.
source§

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

Reads bytes from source until buf is full.
source§

fn take(&mut self, limit: u64) -> Take<'_, Self>

Creates an adapter which will read at most limit bytes.
source§

fn read_to_limit(&mut self, buf: &mut Vec<u8>, limit: u64) -> Result<usize>

Attempts to read up to limit bytes from the reader, allocating space in buf as needed. Read more

Auto Trait Implementations§

§

impl<'a, R: ?Sized> RefUnwindSafe for Take<'a, R>where R: RefUnwindSafe,

§

impl<'a, R: ?Sized> Send for Take<'a, R>where R: Send,

§

impl<'a, R: ?Sized> Sync for Take<'a, R>where R: Sync,

§

impl<'a, R: ?Sized> Unpin for Take<'a, R>

§

impl<'a, R> !UnwindSafe for Take<'a, R>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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.