Skip to main content

UserDatatype

Struct UserDatatype 

Source
pub struct UserDatatype { /* private fields */ }
Expand description

A user-defined (derived) datatype describing a non-contiguous layout as a type map: a set of (byte_offset, byte_length) blocks repeated with a fixed byte extent. Mirrors rsmpi’s UserDatatype.

This implementation supports the common constructors — contiguous, vector, indexed and structured — over a primitive base type. Send a derived layout with View; receive one with MutView.

Implementations§

Source§

impl UserDatatype

Source

pub fn contiguous(count: Count, base: DatatypeRef) -> UserDatatype

count contiguous copies of base (MPI_Type_contiguous).

Source

pub fn vector( count: Count, blocklength: Count, stride: Count, base: DatatypeRef, ) -> UserDatatype

count blocks of blocklength base elements, each stride base elements apart (MPI_Type_vector).

Source

pub fn indexed( blocklengths: &[Count], displacements: &[Count], base: DatatypeRef, ) -> UserDatatype

Blocks of the given per-block lengths at the given base-element displacements (MPI_Type_indexed).

Source

pub fn structured( blocklengths: &[Count], byte_displacements: &[isize], base: DatatypeRef, ) -> UserDatatype

Blocks of the given per-block base-element lengths at explicit byte displacements (MPI_Type_create_struct, single base type).

Source

pub fn id(&self) -> u32

The datatype’s stable id.

Source

pub fn extent(&self) -> usize

The byte extent (stride) of one element (MPI_Type_extent).

Source

pub fn base_count(&self) -> Count

The number of base elements in one element of this datatype.

Source

pub fn pack(&self, base: &[u8], count: Count) -> Vec<u8>

Gather count elements of this datatype from base into a contiguous packed byte buffer.

Source

pub fn unpack(&self, packed: &[u8], base: &mut [u8], count: Count)

Scatter count packed elements back into base according to the type map.

Trait Implementations§

Source§

impl Clone for UserDatatype

Source§

fn clone(&self) -> UserDatatype

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for UserDatatype

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.