[−][src]Struct bastion::message::Msg
A message returned by BastionContext::recv
or
BastionContext::try_recv
that should be passed to the
msg!
macro to try to match what its real type is.
Example
Bastion::children(|children| { children.with_exec(|ctx: BastionContext| { async move { loop { let msg: SignedMessage = ctx.recv().await?; msg! { msg, // We match a broadcasted `&'static str`s... ref msg: &'static str => { // Note that `msg` will actually be a `&&'static str`. assert_eq!(msg, &"A message containing data."); // Handle the message... }; // We match a `&'static str`s "told" to this child... msg: &'static str => { assert_eq!(msg, "A message containing data."); // Handle the message... // get message signature let sign = signature!(); ctx.tell(&sign, "A message containing reply").unwrap(); }; // We match a `&'static str`s "asked" to this child... msg: &'static str =!> { assert_eq!(msg, "A message containing data."); // Handle the message... // ...and eventually answer to it... answer!(ctx, "An answer message containing data."); }; // We match a message that wasn't previously matched... _: _ => (); } } } }) }).expect("Couldn't start the children group.");
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Msg
impl Send for Msg
impl Sync for Msg
impl Unpin for Msg
impl !UnwindSafe for Msg
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> State for T where
T: Send + Sync + 'static,
[src]
T: Send + Sync + 'static,
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>,