PgsSeek

Trait PgsSeek 

Source
pub trait PgsSeek {
    // Required methods
    fn seek(&mut self, to: usize) -> Result<usize>;
    fn pos(&mut self) -> Result<usize>;
    fn len(&self) -> Result<usize>;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

A trait for seeking within a read/write context.

This trait provides methods for seeking to a specific position, querying the current position, getting the length of the data, and checking if the data is non-empty.

Required Methods§

Source

fn seek(&mut self, to: usize) -> Result<usize>

Seeks to a specific position in the data.

§Arguments
  • to - The position to seek to, specified as an offset from the beginning.
§Returns

Returns a Result containing the new position on success, or an Error if the seek operation fails.

Source

fn pos(&mut self) -> Result<usize>

Gets the current position in the data.

§Returns

Returns a Result containing the current position on success, or an Error if the position retrieval fails.

Source

fn len(&self) -> Result<usize>

Gets the total length of the data.

§Returns

Returns a Result containing the length of the data on success, or an Error if length retrieval fails.

Provided Methods§

Source

fn is_empty(&self) -> bool

Checks if the data is non-empty.

This is a convenience method that checks if the length of the data is greater than 0.

§Returns

Returns true if the length of the data is greater than 0, otherwise false.

Implementors§