pub fn broadcast<M: Message>(&self, msg: M) -> Result<(), M> {
        debug!(
            "SupervisorRef({}): Broadcasting message: {:?}",
            self.id(),
            msg
        );
        let msg = BastionMessage::broadcast(msg);
        let env = Envelope::from_dead_letters(msg);
        // FIXME: panics?
        self.send(env).map_err(|env| env.into_msg().unwrap())
    }
/// Sends a message to the supervisor this `SupervisorRef`
/// is referencing which will then send it to all of its
/// supervised children groups and supervisors.
///
/// This method returns `()` if it succeeded, or `Err(msg)`
/// otherwise.
///
/// # Arguments
///
/// * `msg` - The message to send.
///
/// # Example
///
/// ```
/// # use bastion::prelude::*;
/// #
/// # fn main() {
///     # Bastion::init();
///     #
///     # let sp_ref = Bastion::supervisor(|sp| sp).unwrap();
/// let msg = "A message containing data.";
/// sp_ref.broadcast(msg).expect("Couldn't send the message.");
///
///     # Bastion::children(|children| {
///         # children.with_exec(|ctx: BastionContext| {
///             # async move {
/// // And then in every future of the elements of the children
/// // groups that are supervised by this supervisor or one of
/// // its supervised supervisors (etc.)...
/// msg! { ctx.recv().await?,
///     ref msg: &'static str => {
///         assert_eq!(msg, &"A message containing data.");
///     };
///     // We are only broadcasting a `&'static str` in this
///     // example, so we know that this won't happen...
///     _: _ => ();
/// }
///                 #
///                 # Ok(())
///             # }
///         # })
///     # }).unwrap();
///     #
///     # Bastion::start();
///     # Bastion::stop();
///     # Bastion::block_until_stopped();
/// # }
/// ```
Sends a message to the supervisor this `SupervisorRef`
is referencing which will then send it to all of its
supervised children groups and supervisors.

This method returns `()` if it succeeded, or `Err(msg)`
otherwise.
Sends a message to the supervisor this ` SupervisorRef ` is referencing which will then send it to all of its supervised children groups and supervisors . This method returns ` () ` if it succeeded or ` Err ( msg ) ` otherwise .
pub fn broadcast<M: Message>(&self, msg: M) -> Result<(), M> {
        debug!(
            "SupervisorRef({}): Broadcasting message: {:?}",
            self.id(),
            msg
        );
        let msg = BastionMessage::broadcast(msg);
        let env = Envelope::from_dead_letters(msg);
        // FIXME: panics?
        self.send(env).map_err(|env| env.into_msg().unwrap())
    }
pub fn broadcast < M : Message > ( & self , msg : M ) -> Result < ( ) , M > { debug ! ( " " self id ( ) msg ) ; let msg = BastionMessage :: broadcast ( msg ) ; let env = Envelope :: from_dead_letters ( msg ) ; // FIXME: panics? self . send ( env ) . map_err ( | env | env . into_msg ( ) . unwrap ( ) ) }
Sends a message to the supervisor this `SupervisorRef`
is referencing which will then send it to all of its
supervised children groups and supervisors.
Sends a message to the supervisor this ` SupervisorRef ` is referencing which will then send it to all of its supervised children groups and supervisors .
&self
msg
M
&self
msg
M
example
None
use bastion::prelude::*;
None
fn main() {


let sp_ref = Bastion::supervisor(|sp| sp).unwrap();
let msg = "A message containing data.";
sp_ref.broadcast(msg).expect("Couldn't send the message.").

:children(|children| {
children.with_exec(|ctx: BastionContext| {
async move {
And then in every future of the elements of the children
groups that are supervised by this supervisor or one of
its supervised supervisors (etc.)
msg. { ctx.recv().await?,
ref msg: &'static str => {
assert_eq!(msg, &"A message containing data.");
};
We are only broadcasting a `&'static str` in this
example, so we know that this won't happen
_: _ => ();
}



:start();
Bastion::stop();
Bastion::block_until_stopped().
let sp_ref = Bastion :: supervisor ( |sp| sp ) . unwrap () ; let msg = " A message containing data . " ; sp_ref . broadcast ( msg ) . expect ( " Couldn ' t send the message . " ) . : children ( |children| { children . with_exec ( |ctx : BastionContext| { async move { And then in every future of the elements of the children groups that are supervised by this supervisor or one of its supervised supervisors ( etc . ) msg . { ctx . recv () . await? ref msg : & ' static str = > { assert_eq! ( msg & " A message containing data . " ) ; } ; We are only broadcasting a ` & ' static str ` in this example so we know that this won ' t happen _ : _ = > () ; } : start () ; Bastion :: stop () ; Bastion :: block_until_stopped () .
}
None