Skip to main content

ByteBufferMut

Trait ByteBufferMut 

Source
pub trait ByteBufferMut: ByteBuffer + AsMut<[u8]> {
Show 16 methods // Required methods fn set(&self, at: usize, value: u8); fn slice_mut(&self) -> &mut [u8] ; fn slice_start_mut(&self, start: usize) -> &mut [u8] ; fn slice_end_mut(&self, end: usize) -> &mut [u8] ; fn slice_both_mut(&self, start: usize, end: usize) -> &mut [u8] ; fn split_mut(&self, divide: usize) -> (&mut [u8], &mut [u8]); fn rebuffer_start(&self, start: usize) -> Self; fn rebuffer_end(&self, end: usize) -> Self; fn rebuffer_both(&self, start: usize, end: usize) -> Self; fn expand_start(&self, size: usize) -> Self; fn expand_end(&self, size: usize) -> Self; fn split_buf_start(&self, divide: usize) -> (Self, Self); fn split_buf_end(&self, divide: usize) -> (Self, Self); fn append(&self, other: &[u8]) -> Self; fn prepend(&self, other: &[u8]) -> Self; fn ensure_size(&self, size: usize) -> Self;
}
Expand description

Mutable byte buffer trait for read-write access to buffer data. Only implemented by ManagedByteBuffer (pool-attached, mutable, Send).

Required Methods§

Source

fn set(&self, at: usize, value: u8)

Set byte at at index to value. Panics if out of bounds.

Source

fn slice_mut(&self) -> &mut [u8]

Get mutable slice of entire buffer.

Source

fn slice_start_mut(&self, start: usize) -> &mut [u8]

Get mutable slice from start offset to end.

Source

fn slice_end_mut(&self, end: usize) -> &mut [u8]

Get mutable slice from beginning to end offset.

Source

fn slice_both_mut(&self, start: usize, end: usize) -> &mut [u8]

Get mutable slice from start to end offset.

Source

fn split_mut(&self, divide: usize) -> (&mut [u8], &mut [u8])

Split into two mutable slices at divide point. Returns (left, right).

Source

fn rebuffer_start(&self, start: usize) -> Self

Create view with start shifted forward by start bytes.

Source

fn rebuffer_end(&self, end: usize) -> Self

Create view with end at end offset from current start.

Source

fn rebuffer_both(&self, start: usize, end: usize) -> Self

Create view with both start and end adjusted from current start.

Source

fn expand_start(&self, size: usize) -> Self

Expand view backward by size bytes (into header space).

Source

fn expand_end(&self, size: usize) -> Self

Expand view forward by size bytes (into trailer space).

Source

fn split_buf_start(&self, divide: usize) -> (Self, Self)

Split into two buffer views at divide point. Returns (left, right).

Source

fn split_buf_end(&self, divide: usize) -> (Self, Self)

Split into two buffer views at len(buffer) - divide point. Returns (left, right).

Source

fn append(&self, other: &[u8]) -> Self

Append other slice to end. Returns expanded view.

Source

fn prepend(&self, other: &[u8]) -> Self

Prepend other slice to start. Returns expanded view.

Source

fn ensure_size(&self, size: usize) -> Self

Ensure buffer has at least size bytes, expanding or shrinking as needed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§