Seeker interfacev0.1.0

Source
A stream whose position can be moved.
pub interface Seeker {
    func Seek(
        self: &var Self,
        origin: SeekFrom,
        offset: int64
    ) -> uint64 ! IoError;
}

Requirements

Seek

func Seek(
    self: &var Self,
    origin: SeekFrom,
    offset: int64
) -> uint64 ! IoError

Moves the position offset bytes from origin and succeeds with where it landed.

NameTypeDescription
originSeekFromwhere the offset is measured from
offsetint64how far to move, which may be negative

Returns: the resulting offset from the start

Source

Implementations

TypeSummary
ByteReaderA reader of a slice of bytes, from its start.
ByteWriterA writer that keeps what is written in a growing block of memory.

SeekFrom

pub enum SeekFrom: int32 {
    Start = 0,
    Current = 1,
    End = 2
}

Where a seek starts counting from.

Source

Cases

NameValueDescription
Start0The start of the stream; the offset must not be negative.
Current1The current position.
End2The end of the stream.