Trait std::old_io::SeekUnstable [-] [+] [src]

pub trait Seek {
    fn tell(&self) -> IoResult<u64>;
    fn seek(&mut self, pos: i64, style: SeekStyle) -> IoResult<()>;
}

An object implementing Seek internally has some form of cursor which can be moved within a stream of bytes. The stream typically has a fixed size, allowing seeking relative to either end.

Required Methods

fn tell(&self) -> IoResult<u64>

Return position of file cursor in the stream

fn seek(&mut self, pos: i64, style: SeekStyle) -> IoResult<()>

Seek to an offset in a stream

A successful seek clears the EOF indicator. Seeking beyond EOF is allowed, but seeking before position 0 is not allowed.

Errors

  • Seeking to a negative offset is considered an error
  • Seeking past the end of the stream does not modify the underlying stream, but the next write may cause the previous data to be filled in with a bit pattern.

Implementors