Trait ByteBufMut

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so 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§