Trait sodoken::buffer::AsBufRead

source ·
pub trait AsBufRead: 'static + Debug + Send + Sync {
    // Required methods
    fn len(&self) -> usize;
    fn is_empty(&self) -> bool;
    fn read_lock(&self) -> ReadGuard<'_>;
    fn try_unwrap(self: Arc<Self>) -> Result<Box<[u8]>, BufRead>;
}
Expand description

A readable buffer that may or may not be mem_locked.

Required Methods§

source

fn len(&self) -> usize

The length of this buffer.

source

fn is_empty(&self) -> bool

Is this buffer empty?

source

fn read_lock(&self) -> ReadGuard<'_>

Obtain read access to the underlying buffer.

source

fn try_unwrap(self: Arc<Self>) -> Result<Box<[u8]>, BufRead>

Attempt to extract the inner contents of this buf without cloning. If this memory is locked or there are clones of this reference, the unwrap will fail, returning a BufRead instance.

Implementations on Foreign Types§

source§

impl AsBufRead for Box<[u8]>

source§

fn len(&self) -> usize

source§

fn is_empty(&self) -> bool

source§

fn read_lock(&self) -> ReadGuard<'_>

source§

fn try_unwrap(self: Arc<Self>) -> Result<Box<[u8]>, BufRead>

source§

impl AsBufRead for Arc<[u8]>

source§

fn len(&self) -> usize

source§

fn is_empty(&self) -> bool

source§

fn read_lock(&self) -> ReadGuard<'_>

source§

fn try_unwrap(self: Arc<Self>) -> Result<Box<[u8]>, BufRead>

source§

impl AsBufRead for RwLock<Box<[u8]>>

source§

fn len(&self) -> usize

source§

fn is_empty(&self) -> bool

source§

fn read_lock(&self) -> ReadGuard<'_>

source§

fn try_unwrap(self: Arc<Self>) -> Result<Box<[u8]>, BufRead>

source§

impl AsBufRead for RwLock<Vec<u8>>

source§

fn len(&self) -> usize

source§

fn is_empty(&self) -> bool

source§

fn read_lock(&self) -> ReadGuard<'_>

source§

fn try_unwrap(self: Arc<Self>) -> Result<Box<[u8]>, BufRead>

source§

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

source§

fn len(&self) -> usize

source§

fn is_empty(&self) -> bool

source§

fn read_lock(&self) -> ReadGuard<'_>

source§

fn try_unwrap(self: Arc<Self>) -> Result<Box<[u8]>, BufRead>

source§

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

source§

fn len(&self) -> usize

source§

fn is_empty(&self) -> bool

source§

fn read_lock(&self) -> ReadGuard<'_>

source§

fn try_unwrap(self: Arc<Self>) -> Result<Box<[u8]>, BufRead>

Implementors§