Struct positioned_io::SizeCursor [] [src]

pub struct SizeCursor<I: Size>(_);

Adapts a ReadAt or WriteAt into a Read or Write, with better seeking.

This is just like Cursor, except that it requires an object that implements Size, and that it can seek from the end of the I/O object.

Eventually it will be legal to specialize Cursor for types that implement Size, see RFC 1210.

Methods

impl<I> SizeCursor<I> where I: Size
[src]

fn new_pos(io: I, pos: u64) -> Self

Create a new SizeCursor which starts reading at a specified offset.

Pass in a ReadAt or WriteAt as io.

fn new(io: I) -> Self

Create a new SizeCursor which starts reading at offset zero.

Pass in a ReadAt or WriteAt as io.

Methods from Deref<Target=Cursor<I>>

fn into_inner(self) -> I

Consume self and yield the inner ReadAt or WriteAt.

fn get_ref(&self) -> &I

Borrow the inner ReadAt or WriteAt.

fn get_mut(&mut self) -> &mut I

Borrow the inner ReadAt or WriteAt mutably.

fn position(&self) -> u64

Get the current read/write position.

fn set_position(&mut self, pos: u64)

Set the current read/write position.

Trait Implementations

impl<I> Deref for SizeCursor<I> where I: Size
[src]

type Target = Cursor<I>

The resulting type after dereferencing

fn deref(&self) -> &Cursor<I>

The method called to dereference a value

impl<I> DerefMut for SizeCursor<I> where I: Size
[src]

fn deref_mut(&mut self) -> &mut Cursor<I>

The method called to mutably dereference a value

impl<I> Seek for SizeCursor<I> where I: Size
[src]

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

Seek to an offset, in bytes, in a stream. Read more