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, Global>) -> Result<Box<[u8], Global>, 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, Global>) -> Result<Box<[u8], Global>, 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<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<[u8; N], Global>) -> Result<Box<[u8], Global>, BufRead>

source§

impl AsBufRead for Box<[u8], Global>

source§

fn len(&self) -> usize

source§

fn is_empty(&self) -> bool

source§

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

source§

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

source§

impl AsBufRead for Arc<[u8], Global>

source§

fn len(&self) -> usize

source§

fn is_empty(&self) -> bool

source§

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

source§

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

Implementors§