Struct Message

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

Describes a pending incoming message, probed by a matched_probe().

§Standard section(s)

3.8.2

Implementations§

Source§

impl Message

Source

pub fn is_no_proc(&self) -> bool

True if the Source for the probe was the null process.

Source

pub fn matched_receive<Msg>(self) -> (Msg, Status)
where Msg: Equivalence,

Receive a previously probed message containing a single instance of type Msg.

Receives the message &self which contains a single instance of type Msg.

§Panics

Received an empty message

§Standard section(s)

3.8.3

Source

pub fn matched_receive_into<Buf>(self, buf: &mut Buf) -> Status
where Buf: BufferMut + ?Sized,

Receive a previously probed message into a Buffer.

Receive the message &self with contents matching buf.

§Standard section(s)

3.8.3

Source

pub fn immediate_matched_receive_into<'a, Sc, Buf>( self, scope: Sc, buf: &'a mut Buf, ) -> Request<'a, Sc>
where Buf: BufferMut + ?Sized + 'a, Sc: Scope<'a>,

Asynchronously receive a previously probed message into a Buffer.

Asynchronously receive the message &self with contents matching buf.

§Panics

?

§Standard section(s)

3.8.3

Examples found in repository?
examples/immediate.rs (line 51)
8fn main() {
9    let universe = mpi::initialize().unwrap();
10    let world = universe.world();
11
12    let x = std::f32::consts::PI;
13    let mut y: f32 = 0.0;
14
15    mpi::request::scope(|scope| {
16        let mut sreq = world.this_process().immediate_send(scope, &x);
17        let rreq = world.any_process().immediate_receive_into(scope, &mut y);
18        rreq.wait();
19        loop {
20            match sreq.test() {
21                Ok(_) => {
22                    break;
23                }
24                Err(req) => {
25                    sreq = req;
26                }
27            }
28        }
29    });
30    assert_eq!(x, y);
31
32    y = 0.0;
33    mpi::request::scope(|scope| {
34        let _rreq = WaitGuard::from(world.any_process().immediate_receive_into(scope, &mut y));
35        let _sreq = WaitGuard::from(world.this_process().immediate_ready_send(scope, &x));
36    });
37    assert_eq!(x, y);
38
39    assert!(world.any_process().immediate_probe().is_none());
40    assert!(world.any_process().immediate_matched_probe().is_none());
41
42    y = 0.0;
43    mpi::request::scope(|scope| {
44        let _sreq: WaitGuard<_> = world
45            .this_process()
46            .immediate_synchronous_send(scope, &x)
47            .into();
48        let preq = world.any_process().immediate_matched_probe();
49        assert!(preq.is_some());
50        let (msg, _) = preq.unwrap();
51        let _rreq: WaitGuard<_> = msg.immediate_matched_receive_into(scope, &mut y).into();
52    });
53    assert_eq!(x, y);
54
55    let future = world.any_process().immediate_receive();
56    world.this_process().send(&x);
57    let (msg, _) = future.get();
58    assert_eq!(x, msg);
59
60    let future = world.any_process().immediate_receive();
61    let res = future.r#try();
62    assert!(res.is_err());
63    let mut future = res.err().unwrap();
64    world.this_process().send(&x);
65    loop {
66        match future.r#try() {
67            Ok((msg, _)) => {
68                assert_eq!(x, msg);
69                break;
70            }
71            Err(f) => {
72                future = f;
73            }
74        }
75    }
76
77    mpi::request::scope(|scope| {
78        let sreq = world.this_process().immediate_send(scope, &x);
79        sreq.cancel();
80        sreq.wait();
81
82        let _sreq = CancelGuard::from(world.this_process().immediate_receive_into(scope, &mut y));
83    });
84}

Trait Implementations§

Source§

impl AsRaw for Message

Source§

type Raw = *mut ompi_message_t

The raw MPI C API type
Source§

fn as_raw(&self) -> Self::Raw

The raw value
Source§

impl AsRawMut for Message

Source§

fn as_raw_mut(&mut self) -> *mut <Self as AsRaw>::Raw

A mutable pointer to the raw value
Source§

impl Drop for Message

§Panics

?

Source§

fn drop(&mut self)

Executes the destructor for this type. 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<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, 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<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.