[−][src]Struct bastion::children_ref::ChildrenRef
A "reference" to a children group, allowing to communicate with it.
Implementations
impl ChildrenRef
[src]
pub fn id(&self) -> &BastionId
[src]
Returns the identifier of the children group this ChildrenRef
is referencing.
Note that the children group's identifier is reset when it is restarted.
Example
let children_ref = Bastion::children(|children| { // ... }).expect("Couldn't create the children group."); let children_id: &BastionId = children_ref.id();
pub fn dispatchers(&self) -> &Vec<DispatcherType>
[src]
Returns a list of dispatcher names that can be used for communication with other actors in the same group(s).
Example
let dispatchers = children_ref.dispatchers();
pub fn elems(&self) -> &[ChildRef]
[src]
Returns a list of ChildRef
referencing the elements
of the children group this ChildrenRef
is referencing.
Example
let elems: &[ChildRef] = children_ref.elems();
pub fn broadcast<M: Message>(&self, msg: M) -> Result<(), M>
[src]
Sends a message to the children group this ChildrenRef
is referencing which will then send it to all of its
elements.
An alternative would be to use elems
to get all the
elements of the group and then send the message to all
of them.
This method returns ()
if it succeeded, or Err(msg)
otherwise.
Arguments
msg
- The message to send.
Example
let msg = "A message containing data."; children_ref.broadcast(msg).expect("Couldn't send the message."); // And then in every of the children group's elements' futures... msg! { ctx.recv().await?, ref msg: &'static str => { assert_eq!(msg, &"A message containing data."); }; // We are only sending a `&'static str` in this // example, so we know that this won't happen... _: _ => (); }
pub fn stop(&self) -> Result<(), ()>
[src]
Sends a message to the children group this ChildrenRef
is referencing to tell it to stop all of its running
elements.
This method returns ()
if it succeeded, or Err(())
otherwise.
Example
children_ref.stop().expect("Couldn't send the message.");
pub fn kill(&self) -> Result<(), ()>
[src]
Sends a message to the children group this ChildrenRef
is referencing to tell it to kill all of its running
elements.
This method returns ()
if it succeeded, or Err(())
otherwise.
Example
children_ref.kill().expect("Couldn't send the message.");
pub fn path(&self) -> &Arc<BastionPath>
[src]
Returns the BastionPath
of this ChildrenRef
Trait Implementations
impl Clone for ChildrenRef
[src]
fn clone(&self) -> ChildrenRef
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for ChildrenRef
[src]
impl Eq for ChildrenRef
[src]
impl PartialEq<ChildrenRef> for ChildrenRef
[src]
Auto Trait Implementations
impl !RefUnwindSafe for ChildrenRef
impl Send for ChildrenRef
impl Sync for ChildrenRef
impl Unpin for ChildrenRef
impl !UnwindSafe for ChildrenRef
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AsAny for T where
T: Any,
[src]
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Message for T where
T: Any + Send + Sync + Debug,
[src]
T: Any + Send + Sync + Debug,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> State for T where
T: Send + Sync + 'static,
[src]
T: Send + Sync + 'static,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,