pub trait IoBuf: 'static {
// Required method
fn as_init(&self) -> &[u8] ⓘ;
// Provided methods
fn buf_len(&self) -> usize { ... }
fn buf_ptr(&self) -> *const u8 { ... }
fn is_empty(&self) -> bool { ... }
fn slice(self, range: impl RangeBounds<usize>) -> Slice<Self>
where Self: Sized { ... }
fn into_reader(self) -> Reader<Self> ⓘ
where Self: Sized { ... }
fn as_reader(&self) -> ReaderRef<'_, Self> ⓘ { ... }
}Expand description
A trait for immutable buffers.
The IoBuf trait is implemented by buffer types that can be passed to
immutable completion-based IO operations, like writing its content to a
file. This trait will only take initialized bytes of a buffer into account.
Required Methods§
Provided Methods§
Sourcefn into_reader(self) -> Reader<Self> ⓘwhere
Self: Sized,
fn into_reader(self) -> Reader<Self> ⓘwhere
Self: Sized,
Create a Reader from this buffer, which implements
std::io::Read.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl IoBuf for BorrowedBuf<'static>
Available on crate feature read_buf only.
impl IoBuf for BorrowedBuf<'static>
Available on crate feature
read_buf only.