[][src]Macro bastion::children

macro_rules! children {
    ($($keys:ident: $vals:expr,)*) => { ... };
    (@sort,
     $_:expr, $cbs:expr, $action:expr, $($sp:expr)?,
     redundancy: $red:expr,
     $($keys:ident: $vals:expr,)*) => { ... };
    (@sort,
     $red:expr, $_:expr, $action:expr, $($sp:expr)?,
     callbacks: $cbs:expr,
     $($keys:ident: $vals:expr,)*) => { ... };
    (@sort,
     $red:expr, $cbs:expr, $action:expr, $($_:expr)?,
     supervisor: $sp:expr,
     $($keys:ident: $vals:expr,)*) => { ... };
    (@sort,
     $red:expr, $cbs:expr, $_:expr, $($sp:expr)?,
     action: $action:expr,
     $($keys:ident: $vals:expr,)*) => { ... };
    (@sort, $red:expr, $cbs:expr, $action:expr, ,) => { ... };
    (@sort, $red:expr, $cbs:expr, $action:expr, $sp:expr,) => { ... };
}

This macro creates a new children group with the given amount of worker callbacks, and a closure that will be executed when a message is received.

Example

let children = children! {
    // the default redundancy is 1
    redundancy: 100,
    action: |msg| {
        // do something with the message here
    },
};

let sp = supervisor! {};
let children = children! {
    supervisor: sp,
    redundancy: 10,
    action: |msg| {
        // do something with the message here
    },
};