Struct ChannelComm
pub struct ChannelComm<I, T> { /* private fields */ }
Available on crate feature
chili
only.Expand description
Sender-Receiver Communicator based on [crossbeam_channel].
This struct contains one receiver and multiple senders. It can be constructed by using the FromMap trait.
let map = std::collections::BTreeMap::from([
(0, std::collections::BTreeSet::from([1])),
(1, std::collections::BTreeSet::from([0, 2])),
(2, std::collections::BTreeSet::from([1])),
]);
// Construct multiple communicators from a given map.
let mut channel_comms = ChannelComm::from_map(&map).unwrap();
// Send a message from 0 to 1
channel_comms.get_mut(&0).unwrap().send(&1, true);
channel_comms.get_mut(&0).unwrap().send(&1, false);
// Receive all elements at communicator 1
let elements = channel_comms.get_mut(&1).unwrap().receive();
assert_eq!(elements, vec![true, false]);
Trait Implementations§
§impl<I, T> Clone for ChannelComm<I, T>
impl<I, T> Clone for ChannelComm<I, T>
§fn clone(&self) -> ChannelComm<I, T>
fn clone(&self) -> ChannelComm<I, T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl<I, T> Communicator<I, T> for ChannelComm<I, T>
impl<I, T> Communicator<I, T> for ChannelComm<I, T>
§impl<T, I> FromMap<I> for ChannelComm<I, T>where
I: Ord,
impl<T, I> FromMap<I> for ChannelComm<I, T>where
I: Ord,
§fn from_map(
map: &BTreeMap<I, BTreeSet<I>>,
) -> Result<BTreeMap<I, ChannelComm<I, T>>, IndexError>
fn from_map( map: &BTreeMap<I, BTreeSet<I>>, ) -> Result<BTreeMap<I, ChannelComm<I, T>>, IndexError>
SubDomains can be neighboring each
other via complicated graphs.
An easy way to represent this is by using a BTreeMap. We want to create Barriers which match
the specified subdomain indices.
Auto Trait Implementations§
impl<I, T> Freeze for ChannelComm<I, T>
impl<I, T> RefUnwindSafe for ChannelComm<I, T>where
I: RefUnwindSafe,
impl<I, T> Send for ChannelComm<I, T>
impl<I, T> Sync for ChannelComm<I, T>
impl<I, T> Unpin for ChannelComm<I, T>where
T: Unpin,
impl<I, T> UnwindSafe for ChannelComm<I, T>where
I: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.