Trait BytesSeek

Source
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.

Implementations on Foreign Types§

Source§

impl<S: BytesSeek> BytesSeek for &mut S

Source§

fn position(&self) -> usize

Source§

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

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>