pub trait ExactSizeBuf {
    // Required method
    fn len(&self) -> usize;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

A trait for buffers that know their exact length.

Required Methods§

source

fn len(&self) -> usize

Returns the exact length of the buffer.

Provided Methods§

source

fn is_empty(&self) -> bool

Returns true if the buffer is empty.

This method has a default implementation using ExactSizeBuf::len(), so you don’t need to implement it yourself.

Implementations on Foreign Types§

source§

impl ExactSizeBuf for Bytes

source§

fn len(&self) -> usize

source§

fn is_empty(&self) -> bool

source§

impl ExactSizeBuf for BytesMut

source§

fn len(&self) -> usize

source§

fn is_empty(&self) -> bool

source§

impl ExactSizeBuf for [u8]

source§

fn len(&self) -> usize

source§

fn is_empty(&self) -> bool

source§

impl<T> ExactSizeBuf for Take<T>
where T: ExactSizeBuf,

source§

fn len(&self) -> usize

source§

fn is_empty(&self) -> bool

source§

impl<T, U> ExactSizeBuf for Chain<T, U>

source§

fn len(&self) -> usize

source§

fn is_empty(&self) -> bool

Implementors§