Struct Limit

struct Limit<T> { ... }

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

Implementations

impl<T> Limit<T>

fn into_inner(self: Self) -> T

Consumes this Limit, returning the underlying value.

fn get_ref(self: &Self) -> &T

Gets a reference to the underlying BufMut.

It is inadvisable to directly write to the underlying BufMut.

fn get_mut(self: &mut Self) -> &mut T

Gets a mutable reference to the underlying BufMut.

It is inadvisable to directly write to the underlying BufMut.

fn limit(self: &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.

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

Sets the maximum number of bytes that can be written.

Note

If the inner BufMut has fewer bytes than lim then that is the actual number of available bytes.

impl<T> Any for Limit<T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Limit<T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Limit<T>

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

impl<T> Freeze for Limit<T>

impl<T> From for Limit<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> RefUnwindSafe for Limit<T>

impl<T> Send for Limit<T>

impl<T> Sync for Limit<T>

impl<T> Unpin for Limit<T>

impl<T> UnsafeUnpin for Limit<T>

impl<T> UnwindSafe for Limit<T>

impl<T, U> Into for Limit<T>

fn into(self: 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 for Limit<T>

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

impl<T, U> TryInto for Limit<T>

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

impl<T: $crate::fmt::Debug> Debug for Limit<T>

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

impl<T: BufMut> BufMut for Limit<T>

fn remaining_mut(self: &Self) -> usize
fn chunk_mut(self: &mut Self) -> &mut UninitSlice
unsafe fn advance_mut(self: &mut Self, cnt: usize)