Struct sodoken::BufReadSized
source · pub struct BufReadSized<const N: usize>(pub Arc<dyn AsBufReadSized<N>>);
Expand description
A concrete sized read-only buffer type that may or may not be mem_locked.
Tuple Fields§
§0: Arc<dyn AsBufReadSized<N>>
Implementations§
source§impl<const N: usize> BufReadSized<N>
impl<const N: usize> BufReadSized<N>
sourcepub fn new_no_lock(content: [u8; N]) -> BufReadSized<N>
pub fn new_no_lock(content: [u8; N]) -> BufReadSized<N>
Construct a new BufReadSized that is NOT mem_locked.
sourcepub fn read_lock_sized(&self) -> ReadGuardSized<'_, N>
pub fn read_lock_sized(&self) -> ReadGuardSized<'_, N>
Obtain read access to the underlying buffer.
sourcepub fn to_read_unsized(&self) -> BufRead
pub fn to_read_unsized(&self) -> BufRead
Convert to an unsized BufRead instance without cloning internal data and without changing memory locking strategy.
sourcepub fn try_unwrap(self) -> Result<Box<[u8]>, BufRead>
pub fn try_unwrap(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.
sourcepub fn try_unwrap_sized(self) -> Result<[u8; N], BufReadSized<N>>
pub fn try_unwrap_sized(self) -> Result<[u8; N], BufReadSized<N>>
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.
Trait Implementations§
source§impl<const N: usize> Clone for BufReadSized<N>
impl<const N: usize> Clone for BufReadSized<N>
source§fn clone(&self) -> BufReadSized<N>
fn clone(&self) -> BufReadSized<N>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<const N: usize> Debug for BufReadSized<N>
impl<const N: usize> Debug for BufReadSized<N>
source§impl<const S: usize> From<BufReadSized<S>> for BufRead
impl<const S: usize> From<BufReadSized<S>> for BufRead
source§fn from(b: BufReadSized<S>) -> Self
fn from(b: BufReadSized<S>) -> Self
Converts to this type from the input type.
source§impl<const S: usize> From<BufWriteSized<S>> for BufReadSized<S>
impl<const S: usize> From<BufWriteSized<S>> for BufReadSized<S>
source§fn from(b: BufWriteSized<S>) -> Self
fn from(b: BufWriteSized<S>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<const N: usize> !RefUnwindSafe for BufReadSized<N>
impl<const N: usize> Send for BufReadSized<N>
impl<const N: usize> Sync for BufReadSized<N>
impl<const N: usize> Unpin for BufReadSized<N>
impl<const N: usize> !UnwindSafe for BufReadSized<N>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more