logo

Struct bastion::envelope::RefAddr[][src]

pub struct RefAddr { /* fields omitted */ }
Expand description

Message signature used to identify message sender and send messages to it.

Example

Bastion::children(|children| {
    children.with_exec(|ctx: BastionContext| {
        async move {
            // Wait for a message to be received...
            let msg: SignedMessage = ctx.recv().await?;
             
            ctx.tell(msg.signature(), "reply").expect("Unable to reply");
            Ok(())
        }
    })
}).expect("Couldn't create the children group.");

Implementations

Checks whether the sender is identified. Usually anonymous sender means messages sent by broadcast and it’s other methods implied to be called outside of the Bastion context.

Example
let msg = "A message containing data.";
children_ref.broadcast(msg).expect("Couldn't send the message.");

msg! { ctx.recv().await?,
    ref msg: &'static str => {
        assert!(signature!().is_sender_identified());
    };
    // We are only sending a `&'static str` in this
    // example, so we know that this won't happen...
    _: _ => ();
}

Returns BastionPath of a sender

Example
let msg = "A message containing data.";
children_ref.broadcast(msg).expect("Couldn't send the message.");

msg! { ctx.recv().await?,
    ref msg: &'static str => {
        let path = signature!().path();
        assert!(path.is_dead_letters());
    };
    // We are only sending a `&'static str` in this
    // example, so we know that this won't happen...
    _: _ => ();
}

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Downcast implemented type to Any. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more