RegDescList

Struct RegDescList 

Source
pub struct RegDescList<'a> { /* private fields */ }
Expand description

A safe wrapper around a NIXL registration descriptor list

Implementations§

Source§

impl<'a> RegDescList<'a>

Source

pub fn new(mem_type: MemType) -> Result<Self, NixlError>

Creates a new registration descriptor list for the given memory type

Source

pub fn get_type(&self) -> Result<MemType, NixlError>

Source

pub fn add_desc(&mut self, addr: usize, len: usize, dev_id: u64)

Adds a descriptor to the list

Source

pub fn add_desc_with_meta( &mut self, addr: usize, len: usize, dev_id: u64, metadata: &[u8], )

Add a descriptor with metadata

Source

pub fn is_empty(&self) -> Result<bool, NixlError>

Returns true if the list is empty

Source

pub fn desc_count(&self) -> Result<usize, NixlError>

Returns the number of descriptors in the list

Source

pub fn len(&self) -> Result<usize, NixlError>

Returns the number of descriptors in the list

Source

pub fn trim(&mut self)

Trims the list to the given size

Source

pub fn rem_desc(&mut self, index: i32) -> Result<(), NixlError>

Removes the descriptor at the given index

Source

pub fn print(&self) -> Result<(), NixlError>

Prints the list contents

Source

pub fn clear(&mut self)

Clears all descriptors from the list

Source

pub fn resize(&mut self, new_size: usize)

Resizes the list to the given size

Source

pub fn get(&self, index: usize) -> Result<&RegDescriptor, NixlError>

Safe immutable access to descriptor by index

Source

pub fn get_mut(&mut self, index: usize) -> Result<&mut RegDescriptor, NixlError>

Safe mutable access to descriptor by index

Source

pub fn add_storage_desc( &mut self, desc: &'a dyn NixlDescriptor, ) -> Result<(), NixlError>

Add a descriptor from a type implementing NixlDescriptor

§Safety

The caller must ensure that:

  • The descriptor remains valid for the lifetime of the list
  • The memory region pointed to by the descriptor remains valid
Source

pub fn serialize(&self) -> Result<Vec<u8>, NixlError>

Serializes the descriptor list to a byte vector using bincode

Source

pub fn deserialize(bytes: &[u8]) -> Result<Self, NixlError>

Deserializes a descriptor list from a byte slice using bincode

Trait Implementations§

Source§

impl Debug for RegDescList<'_>

Source§

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

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

impl Drop for RegDescList<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Index<usize> for RegDescList<'_>

Source§

type Output = RegDescriptor

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl IndexMut<usize> for RegDescList<'_>

Source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl PartialEq for RegDescList<'_>

Source§

fn eq(&self, other: &Self) -> 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.

Auto Trait Implementations§

§

impl<'a> !Freeze for RegDescList<'a>

§

impl<'a> !RefUnwindSafe for RegDescList<'a>

§

impl<'a> !Send for RegDescList<'a>

§

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

§

impl<'a> Unpin for RegDescList<'a>

§

impl<'a> !UnwindSafe for RegDescList<'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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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>,

Source§

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>,

Source§

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more