pub struct Cursor<T> { /* private fields */ }Expand description
Implementations§
Source§impl<T> Cursor<T>
impl<T> Cursor<T>
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consumes this cursor, returning the underlying value.
Sourcepub const fn get_mut(&mut self) -> &mut T
pub const fn get_mut(&mut self) -> &mut T
Gets a mutable reference to the underlying value in this cursor.
Care should be taken to avoid modifying the internal I/O state of the underlying value as it may corrupt this cursor’s position.
Sourcepub const fn set_position(&mut self, pos: u64)
pub const fn set_position(&mut self, pos: u64)
Sets the position of this cursor.
Trait Implementations§
Source§impl<T> BufRead for Cursor<T>
impl<T> BufRead for Cursor<T>
Source§fn fill_buf(&mut self) -> Result<&[u8]>
fn fill_buf(&mut self) -> Result<&[u8]>
Returns the contents of the internal buffer, filling it with more data, via
Read methods,
if empty.Source§fn consume(&mut self, amt: usize)
fn consume(&mut self, amt: usize)
Marks the given
amount of additional bytes from the internal buffer as having been read.
Subsequent calls to read only return bytes that have not been marked as read.Source§fn has_data_left(&mut self) -> Result<bool>
fn has_data_left(&mut self) -> Result<bool>
Checks if there is any data left to be
read.Source§impl<T> Read for Cursor<T>
impl<T> Read for Cursor<T>
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning
how many bytes were read.
Source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
Read the exact number of bytes required to fill
buf.Source§fn read_buf(&mut self, cursor: BorrowedCursor<'_>) -> Result<()>
fn read_buf(&mut self, cursor: BorrowedCursor<'_>) -> Result<()>
Pull some bytes from this source into the specified buffer. Read more
Source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<()>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<()>
Reads the exact number of bytes required to fill
cursor. Read moreSource§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Creates a “by reference” adapter for this instance of
Read. Read moreSource§impl<T> Seek for Cursor<T>
impl<T> Seek for Cursor<T>
Source§fn seek(&mut self, style: SeekFrom) -> Result<u64>
fn seek(&mut self, style: SeekFrom) -> Result<u64>
Seek to an offset, in bytes, in a stream. Read more
Source§fn stream_len(&mut self) -> Result<u64>
fn stream_len(&mut self) -> Result<u64>
Returns the length of this stream (in bytes).
Source§impl Write for Cursor<&mut [u8]>
impl Write for Cursor<&mut [u8]>
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written.
Source§fn write_all(&mut self, buf: &[u8]) -> Result<()>
fn write_all(&mut self, buf: &[u8]) -> Result<()>
Attempts to write an entire buffer into this writer.
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered
contents reach their destination.
Source§impl<const N: usize> Write for Cursor<[u8; N]>
impl<const N: usize> Write for Cursor<[u8; N]>
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written.
Source§fn write_all(&mut self, buf: &[u8]) -> Result<()>
fn write_all(&mut self, buf: &[u8]) -> Result<()>
Attempts to write an entire buffer into this writer.
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered
contents reach their destination.
impl<T: Eq> Eq for Cursor<T>
impl<T> StructuralPartialEq for Cursor<T>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more