Seeker interfacev0.1.0
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.
| Name | Type | Description |
|---|---|---|
origin | SeekFrom | where the offset is measured from |
offset | int64 | how far to move, which may be negative |
Returns: the resulting offset from the start
Implementations
| Type | Summary |
|---|---|
ByteReader | A reader of a slice of bytes, from its start. |
ByteWriter | A writer that keeps what is written in a growing block of memory. |
Related
SeekFrom
pub enum SeekFrom: int32 {
Start = 0,
Current = 1,
End = 2
}
Where a seek starts counting from.
Cases
| Name | Value | Description |
|---|---|---|
Start | 0 | The start of the stream; the offset must not be negative. |
Current | 1 | The current position. |
End | 2 | The end of the stream. |