Skip to main content

Cursor

Struct Cursor 

Source
pub struct Cursor<T> {
    inner: T,
    pos: u64,
}

Fields§

§inner: T§pos: u64

Implementations§

Source§

impl<T> Cursor<T>

Source

pub fn new(inner: T) -> Self

Source

pub fn position(&self) -> u64

Source

pub fn set_position(&mut self, pos: u64)

Source

pub fn into_inner(self) -> T

Source

pub fn get_ref(&self) -> &T

Source§

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

Source

fn data(&self) -> &[u8]

Trait Implementations§

Source§

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

Source§

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

Source§

fn consume(&mut self, amt: usize)

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn take(self, limit: u64) -> Take<Self>
where Self: Sized,

Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Source§

fn bytes(self) -> Bytes<Self>
where Self: Sized,

Source§

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

Source§

fn seek(&mut self, pos: SeekFrom) -> Result<u64>

Source§

fn stream_position(&mut self) -> Result<u64>

Source§

fn seek_relative(&mut self, offset: i64) -> Result<()>

Auto Trait Implementations§

§

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

§

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

§

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

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<R> ReadBytesExt for R
where R: Read + ?Sized,

Source§

fn read_u8(&mut self) -> Result<u8>

Source§

fn read_i8(&mut self) -> Result<i8>

Source§

fn read_u16<B: ByteOrder>(&mut self) -> Result<u16>

Source§

fn read_u24<B: ByteOrder>(&mut self) -> Result<u32>

Source§

fn read_u32<B: ByteOrder>(&mut self) -> Result<u32>

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.