Struct std::io::CursorUnstable
[-] [+]
[src]
pub struct Cursor<T> { // some fields omitted }
A Cursor
is a type which wraps another I/O object to provide a Seek
implementation.
Cursors are currently typically used with memory buffer objects in order to
allow Seek
plus Read
and Write
implementations. For example, common
cursor types include:
Cursor<Vec<u8>>
Cursor<&[u8]>
Implementations of the I/O traits for Cursor<T>
are not currently generic
over T
itself. Instead, specific implementations are provided for various
in-memory buffer types like Vec<u8>
and &[u8]
.
Methods
impl<T> Cursor<T>
fn new(inner: T) -> Cursor<T>
Create a new cursor wrapping the provided underlying I/O object.
fn into_inner(self) -> T
Consume this cursor, returning the underlying value.
fn get_ref(&self) -> &T
Get a reference to the underlying value in this cursor.
fn get_mut(&mut self) -> &mut T
Get 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.
fn position(&self) -> u64
Returns the current value of this cursor
fn set_position(&mut self, pos: u64)
Sets the value of this cursor