Struct bitcoin_io::Cursor

source ·
pub struct Cursor<T> { /* private fields */ }
Expand description

Wraps an in memory reader providing the position function.

Implementations§

source§

impl<T: AsRef<[u8]>> Cursor<T>

source

pub fn new(inner: T) -> Self

Creates a Cursor by wrapping inner.

source

pub fn position(&self) -> u64

Returns the position read up to thus far.

source

pub fn into_inner(self) -> T

Returns the inner buffer.

This is the whole wrapped buffer, including the bytes already read.

Trait Implementations§

source§

impl<T: AsRef<[u8]>> BufRead for Cursor<T>

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<T: AsRef<[u8]>> Read for Cursor<T>

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<T> RefUnwindSafe for Cursor<T>where T: RefUnwindSafe,

§

impl<T> Send for Cursor<T>where T: Send,

§

impl<T> Sync for Cursor<T>where T: Sync,

§

impl<T> Unpin for Cursor<T>where T: Unpin,

§

impl<T> UnwindSafe for Cursor<T>where T: UnwindSafe,

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.