Trait w5500_hl::io::Seek

source ·
pub trait Seek {
    // Required methods
    fn seek<E>(&mut self, pos: SeekFrom) -> Result<(), Error<E>>;
    fn rewind(&mut self);
    fn stream_len(&self) -> u16;
    fn stream_position(&self) -> u16;
    fn remain(&self) -> u16;
}
Expand description

The Seek trait provides a cursor which can be moved within a stream of bytes.

This is used for navigating the socket buffers, and it is designed to be similar to std::io::Seek.

Required Methods§

source

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

Seek to an offset, in bytes, within the socket buffer.

Seeking beyond the limits will result Error::UnexpectedEof.

Limits
  • UdpWriter is limited by socket free size.
  • UdpReader is limited by the received size or the UDP datagram length, whichever is less.
  • TcpWriter is limited by socket free size.
  • TcpReader is limited by the received size.
source

fn rewind(&mut self)

Rewind to the beginning of the stream.

This is a convenience method, equivalent to seek(SeekFrom::Start(0)).

source

fn stream_len(&self) -> u16

Return the length of the stream, in bytes.

  • For TcpWriter this returns the socket free size.
  • For TcpReader this returns the received size.
  • For UdpWriter this returns the socket free size.
  • For UdpReader this returns the received size or the UDP datagram length, whichever is less.
source

fn stream_position(&self) -> u16

Returns the current seek position from the start of the stream.

source

fn remain(&self) -> u16

Remaining bytes in the socket buffer from the current seek position.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'w, W5500> Seek for TcpReader<'w, W5500>

source§

impl<'w, W5500> Seek for TcpWriter<'w, W5500>

source§

impl<'w, W5500> Seek for UdpReader<'w, W5500>

source§

impl<'w, W5500> Seek for UdpWriter<'w, W5500>