pub trait EmptyChunk {
// Required method
fn empty() -> Self
where Self: Sized;
}Expand description
A trait for chunk-like buffer types (such as Chunk and ChunkMut) that can be
instantiated directly as empty.
Required Methods§
Sourcefn empty() -> Selfwhere
Self: Sized,
fn empty() -> Selfwhere
Self: Sized,
Creates an empty buffer instance.
The returned value must represent an empty view of the underlying data.
For types implementing Chunk, this implies remaining() == 0 and
buffer().is_empty(). For mutable chunk-like types (such as ChunkMut),
this implies there are no readable or writable bytes available according
to that type’s API.
This is a convenience method for creating an empty buffer of the implementing type.
§Examples
use bufkit::{Chunk, EmptyChunk};
let empty_buf = <&[u8]>::empty();
assert_eq!(empty_buf.remaining(), 0);
assert!(empty_buf.buffer().is_empty());Implementations on Foreign Types§
Source§impl EmptyChunk for &mut [u8]
impl EmptyChunk for &mut [u8]
Source§impl EmptyChunk for Bytes
Available on crate feature bytes_1 and (crate features std or alloc) only.
impl EmptyChunk for Bytes
Available on crate feature
bytes_1 and (crate features std or alloc) only.Source§impl<T: EmptyChunk> EmptyChunk for Box<T>
Available on crate features std or alloc only.
impl<T: EmptyChunk> EmptyChunk for Box<T>
Available on crate features
std or alloc only.