BufferMut

Struct BufferMut 

Source
pub struct BufferMut<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> BufferMut<'a>

Source

pub fn new(slice: &'a mut [u8]) -> Self

Source

pub fn as_slice(&self) -> &[u8]

Source

pub fn as_mut_slice(&mut self) -> &mut [u8]

Source

pub fn append(&mut self, bytes: &[u8])

Appends the provided bytes to the buffer, panicking if insufficient space is available in the buffer.

Source

pub fn append_or<T>(&mut self, bytes: &[u8], error: T) -> Result<(), T>

Appends the provided bytes to the buffer, returning error if insufficient space is available in the buffer.

Source

pub fn try_append(&mut self, bytes: &[u8]) -> Option<()>

Appends the provided bytes to the buffer, panicking if insufficient space is available in the buffer.

Source

pub fn truncate(&mut self, pos: usize)

Truncates the buffer to the specified position.

Source

pub fn to_mut_slice(self) -> &'a mut [u8]

Source

pub fn len(&self) -> usize

The length of the stored buffer.

Source

pub fn is_empty(&self) -> bool

Source

pub fn remaining(&self) -> usize

The number of unused bytes in the buffer.

Trait Implementations§

Source§

impl<'a> Debug for BufferMut<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Index<Range<usize>> for BufferMut<'_>

Source§

type Output = [u8]

The returned type after indexing.
Source§

fn index(&self, index: Range<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<RangeFrom<usize>> for BufferMut<'_>

Source§

type Output = [u8]

The returned type after indexing.
Source§

fn index(&self, index: RangeFrom<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<RangeInclusive<usize>> for BufferMut<'_>

Source§

type Output = [u8]

The returned type after indexing.
Source§

fn index(&self, index: RangeInclusive<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<RangeTo<usize>> for BufferMut<'_>

Source§

type Output = [u8]

The returned type after indexing.
Source§

fn index(&self, index: RangeTo<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<RangeToInclusive<usize>> for BufferMut<'_>

Source§

type Output = [u8]

The returned type after indexing.
Source§

fn index(&self, index: RangeToInclusive<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl Index<usize> for BufferMut<'_>

Source§

type Output = u8

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for BufferMut<'a>

§

impl<'a> RefUnwindSafe for BufferMut<'a>

§

impl<'a> Send for BufferMut<'a>

§

impl<'a> Sync for BufferMut<'a>

§

impl<'a> Unpin for BufferMut<'a>

§

impl<'a> !UnwindSafe for BufferMut<'a>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.