vortex_buffer::io_buf

Trait IoBuf

Source
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§

Source

fn read_ptr(&self) -> *const u8

Returns a raw pointer to the vector’s buffer.

Source

fn bytes_init(&self) -> usize

Number of initialized bytes.

Source

fn as_slice(&self) -> &[u8]

Access the buffer as a byte slice

Provided Methods§

Source

fn slice_owned(self, range: Range<usize>) -> Slice<Self>
where Self: Sized,

Access the buffer as a byte slice with begin and end indices

Implementations on Foreign Types§

Source§

impl IoBuf for &'static [u8]

Source§

fn read_ptr(&self) -> *const u8

Source§

fn bytes_init(&self) -> usize

Source§

fn as_slice(&self) -> &[u8]

Source§

impl IoBuf for Vec<u8>

Source§

fn read_ptr(&self) -> *const u8

Source§

fn bytes_init(&self) -> usize

Source§

fn as_slice(&self) -> &[u8]

Source§

impl<const N: usize> IoBuf for [u8; N]

Source§

fn read_ptr(&self) -> *const u8

Source§

fn bytes_init(&self) -> usize

Source§

fn as_slice(&self) -> &[u8]

Implementors§

Source§

impl IoBuf for Buffer

Source§

impl<T: IoBuf> IoBuf for Slice<T>