kvarn_async::prelude::bytes::buf

Struct Limit

pub struct Limit<T> { /* private fields */ }
Expand description

A BufMut adapter which limits the amount of bytes that can be written to an underlying buffer.

Implementations§

§

impl<T> Limit<T>

pub fn into_inner(self) -> T

Consumes this Limit, returning the underlying value.

pub fn get_ref(&self) -> &T

Gets a reference to the underlying BufMut.

It is inadvisable to directly write to the underlying BufMut.

pub fn get_mut(&mut self) -> &mut T

Gets a mutable reference to the underlying BufMut.

It is inadvisable to directly write to the underlying BufMut.

pub fn limit(&self) -> usize

Returns the maximum number of bytes that can be written

§Note

If the inner BufMut has fewer bytes than indicated by this method then that is the actual number of available bytes.

pub fn set_limit(&mut self, lim: usize)

Sets the maximum number of