pub struct RefAddr { /* private fields */ }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§
Source§impl RefAddr
impl RefAddr
Sourcepub fn is_sender_identified(&self) -> bool
pub fn is_sender_identified(&self) -> bool
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...
_: _ => ();
}Sourcepub fn path(&self) -> &Arc<BastionPath>
pub fn path(&self) -> &Arc<BastionPath>
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§
Auto Trait Implementations§
impl Freeze for RefAddr
impl !RefUnwindSafe for RefAddr
impl Send for RefAddr
impl Sync for RefAddr
impl Unpin for RefAddr
impl !UnwindSafe for RefAddr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more