pub trait Seek {
    type Err;

    fn seek(&mut self, pos: SeekFrom) -> Result<u32, Self::Err>;
    fn cursor_position(&self) -> u32;
}
Expand description

The Seek trait provides a cursor which can be moved within a stream of bytes. This is essentially a copy of std::io::Seek, but avoiding its dependency on std::io::Error, and the associated code size increase. Additionally, the positions are expressed in terms of 32-bit integers since this is adequate for the sizes of data in smart contracts.

Required Associated Types

Required Methods

Seek to the new position. If successful, return the new position from the beginning of the stream.

Get the cursor position counted from the beginning of the stream.

Implementors