pub unsafe trait IoBuf: Unpin + 'static {
// Required methods
fn read_ptr(&self) -> *const u8;
fn bytes_init(&self) -> usize;
fn as_slice(&self) -> &[u8] ⓘ;
// Provided method
fn slice_owned(self, range: Range<usize>) -> Slice<Self>
where Self: Sized { ... }
}
Expand description
Trait for types that can provide a readonly byte buffer interface to I/O frameworks.
§Safety
The type must support contiguous raw memory access via pointer, such as Vec
or [u8]
.
Required Methods§
sourcefn bytes_init(&self) -> usize
fn bytes_init(&self) -> usize
Number of initialized bytes.