pub trait ByteBufMut: BufMut {
    // Required methods
    fn offset(&self) -> usize;
    fn seek(&mut self, offset: usize);
    fn range(&mut self, r: Range<usize>) -> &mut [u8] ;

    // Provided methods
    fn put_gap(&mut self, len: usize) -> Gap { ... }
    fn gap_buf(&mut self, gap: Gap) -> &mut [u8]  { ... }
    fn put_typed_gap<T: GapType>(&mut self, type_: T) -> TypedGap<T> { ... }
    fn fill_typed_gap<T: GapType>(&mut self, gap: TypedGap<T>, value: T::Value) { ... }
}
Expand description

Extension for working with bytes::buf::BufMut.

Required Methods§

source

fn offset(&self) -> usize

Get the current offset of the buffer.

source

fn seek(&mut self, offset: usize)

Seek to the provided offset in the buffer.

source

fn range(&mut self, r: Range<usize>) -> &mut [u8]

Read a range from the buffer.

Provided Methods§

source

fn put_gap(&mut self, len: usize) -> Gap

Put a gap of len at the current buffer offset.

source

fn gap_buf(&mut self, gap: Gap) -> &mut [u8]

Read a gap from the buffer.

source

fn put_typed_gap<T: GapType>(&mut self, type_: T) -> TypedGap<T>

Put a typed gap of type T at the current buffer offset.

source

fn fill_typed_gap<T: GapType>(&mut self, gap: TypedGap<T>, value: T::Value)

Insert a value of the TypedGap type at the current buffer offset.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl ByteBufMut for Vec<u8>

source§

fn offset(&self) -> usize

source§

fn seek(&mut self, offset: usize)

source§

fn range(&mut self, r: Range<usize>) -> &mut [u8]

source§

impl ByteBufMut for BytesMut

source§

fn offset(&self) -> usize

source§

fn seek(&mut self, offset: usize)

source§

fn range(&mut self, r: Range<usize>) -> &mut [u8]

source§

impl<T: ByteBufMut> ByteBufMut for &mut T

source§

fn offset(&self) -> usize

source§

fn seek(&mut self, offset: usize)

source§

fn range(&mut self, r: Range<usize>) -> &mut [u8]

Implementors§