pub trait BytesSeek {
    // Required methods
    fn position(&self) -> usize;
    fn try_seek(&mut self, pos: usize) -> Result<(), SeekError>;

    // Provided methods
    fn seek(&mut self, pos: usize) { ... }
    fn try_advance(&mut self, adv: usize) -> Result<(), SeekError> { ... }
    fn advance(&mut self, adv: usize) { ... }
}
Expand description

Sets the internal position for writing or reading.

Required Methods§

source

fn position(&self) -> usize

Returns the internal position.

source

fn try_seek(&mut self, pos: usize) -> Result<(), SeekError>

Sets the internal position if possible.

Provided Methods§

source

fn seek(&mut self, pos: usize)

Sets the internal position.

source

fn try_advance(&mut self, adv: usize) -> Result<(), SeekError>

Advances the internal position if possible.

source

fn advance(&mut self, adv: usize)

Advances the internal position.

Panic

May panic depending on the BytesSeek::seek implementation.

Implementors§

source§

impl BytesSeek for Bytes<'_>

source§

impl BytesSeek for BytesMut<'_>

source§

impl BytesSeek for BytesOwned

source§

impl BytesSeek for Cursor<&mut Vec<u8>>

source§

impl BytesSeek for Cursor<Vec<u8>>

source§

impl<'a> BytesSeek for Cursor<&'a [u8]>

source§

impl<'a> BytesSeek for Cursor<&'a mut [u8]>

source§

impl<T> BytesSeek for Offset<T>where T: BytesSeek,

source§

impl<const L: usize> BytesSeek for Cursor<[u8; L]>

source§

impl<const N: usize> BytesSeek for BytesArray<N>