Struct Status

Source
pub struct Status(/* private fields */);
Expand description

Describes the result of a point to point receive operation.

§Standard section(s)

3.2.5

Implementations§

Source§

impl Status

Source

pub fn from_raw(status: MPI_Status) -> Status

Construct a Status value from the raw MPI type

Source

pub fn source_rank(&self) -> Rank

The rank of the message source

Examples found in repository?
examples/readme.rs (line 30)
7fn main() {
8    let universe = mpi::initialize().unwrap();
9    let world = universe.world();
10    let size = world.size();
11    let rank = world.rank();
12
13    let next_rank = if rank + 1 < size { rank + 1 } else { 0 };
14    let previous_rank = if rank > 0 { rank - 1 } else { size - 1 };
15
16    let msg = vec![rank, 2 * rank, 4 * rank];
17    mpi::request::scope(|scope| {
18        let _sreq = WaitGuard::from(
19            world
20                .process_at_rank(next_rank)
21                .immediate_send(scope, &msg[..]),
22        );
23
24        let (msg, status) = world.any_process().receive_vec();
25
26        println!(
27            "Process {} got message {:?}.\nStatus is: {:?}",
28            rank, msg, status
29        );
30        let x = status.source_rank();
31        assert_eq!(x, previous_rank);
32        assert_eq!(vec![x, 2 * x, 4 * x], msg);
33
34        let root_rank = 0;
35        let root_process = world.process_at_rank(root_rank);
36
37        let mut a;
38        if world.rank() == root_rank {
39            a = vec![2, 4, 8, 16];
40            println!("Root broadcasting value: {:?}.", &a[..]);
41        } else {
42            a = vec![0; 4];
43        }
44        root_process.broadcast_into(&mut a[..]);
45        println!("Rank {} received value: {:?}.", world.rank(), &a[..]);
46        assert_eq!(&a[..], &[2, 4, 8, 16]);
47    });
48}
More examples
Hide additional examples
examples/send_receive.rs (line 38)
8fn main() {
9    let universe = mpi::initialize().unwrap();
10    let world = universe.world();
11    let size = world.size();
12    let rank = world.rank();
13
14    let next_rank = if rank + 1 < size { rank + 1 } else { 0 };
15    let next_process = world.process_at_rank(next_rank);
16    let previous_rank = if rank > 0 { rank - 1 } else { size - 1 };
17    let previous_process = world.process_at_rank(previous_rank);
18
19    let (msg, status): (Rank, _) = p2p::send_receive(&rank, &previous_process, &next_process);
20    println!(
21        "Process {} got message {}.\nStatus is: {:?}",
22        rank, msg, status
23    );
24    world.barrier();
25    assert_eq!(msg, next_rank);
26
27    if rank > 0 {
28        let msg = vec![rank, rank + 1, rank - 1];
29        world.process_at_rank(0).send(&msg[..]);
30    } else {
31        for _ in 1..size {
32            let (msg, status) = world.any_process().receive_vec::<Rank>();
33            println!(
34                "Process {} got long message {:?}.\nStatus is: {:?}",
35                rank, msg, status
36            );
37
38            let x = status.source_rank();
39            let v = vec![x, x + 1, x - 1];
40            assert_eq!(v, msg);
41        }
42    }
43    world.barrier();
44
45    let mut x = rank;
46    p2p::send_receive_replace_into(&mut x, &next_process, &previous_process);
47    assert_eq!(x, previous_rank);
48}
Source

pub fn tag(&self) -> Tag

The message tag

Source

pub fn count<D: Datatype>(&self, d: D) -> Count

Number of instances of the type contained in the message

Trait Implementations§

Source§

impl Clone for Status

Source§

fn clone(&self) -> Status

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Status

Source§

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

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

impl Copy for Status

Auto Trait Implementations§

§

impl Freeze for Status

§

impl RefUnwindSafe for Status

§

impl Send for Status

§

impl Sync for Status

§

impl Unpin for Status

§

impl UnwindSafe for Status

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<Src, Scheme> ApproxFrom<Src, Scheme> for Src
where Scheme: ApproxScheme,

Source§

type Err = NoError

The error type produced by a failed conversion.
Source§

fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>

Convert the given value into an approximately equivalent representation.
Source§

impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Src
where Dst: ApproxFrom<Src, Scheme>, Scheme: ApproxScheme,

Source§

type Err = <Dst as ApproxFrom<Src, Scheme>>::Err

The error type produced by a failed conversion.
Source§

fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>

Convert the subject into an approximately equivalent representation.
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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T, Dst> ConvAsUtil<Dst> for T

Source§

fn approx(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject with the default scheme.
Source§

fn approx_by<Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject with a specific scheme.
Source§

impl<T> ConvUtil for T

Source§

fn approx_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject to a given type with the default scheme.
Source§

fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject to a given type with a specific scheme.
Source§

fn into_as<Dst>(self) -> Dst
where Self: Sized + Into<Dst>,

Convert the subject to a given type.
Source§

fn try_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + TryInto<Dst>,

Attempt to convert the subject to a given type.
Source§

fn value_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ValueInto<Dst>,

Attempt a value conversion of the subject to a given type.
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<Src> TryFrom<Src> for Src

Source§

type Err = NoError

The error type produced by a failed conversion.
Source§

fn try_from(src: Src) -> Result<Src, <Src as TryFrom<Src>>::Err>

Convert the given value into the subject type.
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<Src, Dst> TryInto<Dst> for Src
where Dst: TryFrom<Src>,

Source§

type Err = <Dst as TryFrom<Src>>::Err

The error type produced by a failed conversion.
Source§

fn try_into(self) -> Result<Dst, <Src as TryInto<Dst>>::Err>

Convert the subject into the destination type.
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<Src> ValueFrom<Src> for Src

Source§

type Err = NoError

The error type produced by a failed conversion.
Source§

fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>

Convert the given value into an exactly equivalent representation.
Source§

impl<Src, Dst> ValueInto<Dst> for Src
where Dst: ValueFrom<Src>,

Source§

type Err = <Dst as ValueFrom<Src>>::Err

The error type produced by a failed conversion.
Source§

fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>

Convert the subject into an exactly equivalent representation.