Struct bastion::children_ref::ChildrenRef [−][src]
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]
pub 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
[src]
impl Send for ChildrenRef
[src]
impl Sync for ChildrenRef
[src]
impl Unpin for ChildrenRef
[src]
impl !UnwindSafe for ChildrenRef
[src]
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,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[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> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
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.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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.
pub 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>,