RxBuffer

Trait RxBuffer 

Source
pub trait RxBuffer {
    // Required methods
    fn capacity(&self) -> usize;
    fn as_c_void(&mut self) -> (*mut c_void, size_t);
    fn as_c_char(&mut self) -> (*mut c_char, size_t);
    unsafe fn done(&mut self, len: size_t) -> &mut [u8] ;

    // Provided method
    fn can_set_capacity(&mut self) -> Option<&mut dyn ResizeableBuffer> { ... }
}
Expand description

The ‘RxBuffer’ is a used when reading data in. The contents of the buffer can be uninitialized.

Required Methods§

Source

fn capacity(&self) -> usize

The allocated size

Source

fn as_c_void(&mut self) -> (*mut c_void, size_t)

Returns a void*/size_t pair to be used in the C call.

Source

fn as_c_char(&mut self) -> (*mut c_char, size_t)

Returns a char*/size_t pair to be used in the C call.

Source

unsafe fn done(&mut self, len: size_t) -> &mut [u8]

After the reading operation is done the buffer must be sealed with the actual length of the data retrieved. This function returns a slice into the buffer containing the data.

Provided Methods§

Source

fn can_set_capacity(&mut self) -> Option<&mut dyn ResizeableBuffer>

Get a ‘Some(ResizeableBuffer)’ when the underlying Buffer supports allocating more memory

Implementations on Foreign Types§

Source§

impl RxBuffer for Vec<u8>

Source§

fn capacity(&self) -> usize

Source§

fn as_c_void(&mut self) -> (*mut c_void, size_t)

Source§

fn as_c_char(&mut self) -> (*mut c_char, size_t)

Source§

unsafe fn done(&mut self, len: usize) -> &mut [u8]

Source§

fn can_set_capacity(&mut self) -> Option<&mut dyn ResizeableBuffer>

Source§

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

Source§

fn capacity(&self) -> usize

Source§

fn as_c_void(&mut self) -> (*mut c_void, size_t)

Source§

fn as_c_char(&mut self) -> (*mut c_char, size_t)

Source§

unsafe fn done(&mut self, len: usize) -> &mut [u8]

Source§

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

Source§

fn capacity(&self) -> usize

Source§

fn as_c_void(&mut self) -> (*mut c_void, size_t)

Source§

fn as_c_char(&mut self) -> (*mut c_char, size_t)

Source§

unsafe fn done(&mut self, len: usize) -> &mut [u8]

Implementors§