Struct abi::bbqueue_ipc::bbbuffer::SplitGrantR

source ·
pub struct SplitGrantR<'a> {
    pub(crate) buf1: &'a mut [u8],
    pub(crate) buf2: &'a mut [u8],
    bbq: NonNull<BBBuffer>,
    pub(crate) to_release: usize,
}
Expand description

A structure representing up to two contiguous regions of memory that may be read from, and potentially “released” (or cleared) from the queue

Fields§

§buf1: &'a mut [u8]§buf2: &'a mut [u8]§bbq: NonNull<BBBuffer>§to_release: usize

Implementations§

source§

impl<'a> SplitGrantR<'a>

source

pub fn release(self, used: usize)

Release a sequence of bytes from the buffer, allowing the space to be used by later writes. This consumes the grant.

If used is larger than the given grant, the full grant will be released.

NOTE: if the target doesn’t have atomics, this function takes a short critical section while releasing.

source

pub fn bufs(&self) -> (&[u8], &[u8])

Obtain access to both inner buffers for reading

source

pub fn bufs_mut(&mut self) -> (&mut [u8], &mut [u8])

Obtain mutable access to both parts of the read grant

This is useful if you are performing in-place operations on an incoming packet, such as decryption

source

pub(crate) fn release_inner(&mut self, used: usize)

source

pub fn to_release(&mut self, amt: usize)

Configures the amount of bytes to be released on drop.

source

pub fn combined_len(&self) -> usize

The combined length of both buffers

Trait Implementations§

source§

impl<'a> Debug for SplitGrantR<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Drop for SplitGrantR<'a>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'a> PartialEq for SplitGrantR<'a>

source§

fn eq(&self, other: &SplitGrantR<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> Send for SplitGrantR<'a>

source§

impl<'a> StructuralPartialEq for SplitGrantR<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for SplitGrantR<'a>

§

impl<'a> RefUnwindSafe for SplitGrantR<'a>

§

impl<'a> !Sync for SplitGrantR<'a>

§

impl<'a> Unpin for SplitGrantR<'a>

§

impl<'a> !UnwindSafe for SplitGrantR<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.