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§
Source§impl<I: Clone, T: Clone> Clone for ChannelComm<I, T>
impl<I: Clone, T: Clone> Clone for ChannelComm<I, T>
Source§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 moreSource§impl<I, T> Communicator<I, T> for ChannelComm<I, T>
impl<I, T> Communicator<I, T> for ChannelComm<I, T>
Source§impl<T, I> FromMap<I> for ChannelComm<I, T>where
I: Ord,
impl<T, I> FromMap<I> for ChannelComm<I, T>where
I: Ord,
Source§fn from_map(
map: &BTreeMap<I, BTreeSet<I>>,
) -> Result<BTreeMap<I, Self>, IndexError>
fn from_map( map: &BTreeMap<I, BTreeSet<I>>, ) -> Result<BTreeMap<I, Self>, 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