pub struct ActorRef<A, S, L = NoLifecycle> { /* private fields */ }Expand description
A typed, directly resolved handle to an actor’s user protocol.
References are issued by crate::System::spawn and may be cloned, but
their concrete mailbox sender cannot be supplied or extracted externally.
The message and event types are associated facts of the sender’s event
protocol, not independent choices.
ⓘ
use bombay::{ActorRef, behavior::MailAddr};
let _: ActorRef<MailAddr, ()> = ActorRef::new(MailAddr(1), ());Implementations§
Source§impl<A, S, L> ActorRef<A, S, L>
impl<A, S, L> ActorRef<A, S, L>
Sourcepub async fn send(
&self,
from: A,
message: <<S as EventSender>::Event as UserEvent>::Message,
) -> Result<(), <S as EventSender>::Error>
pub async fn send( &self, from: A, message: <<S as EventSender>::Event as UserEvent>::Message, ) -> Result<(), <S as EventSender>::Error>
Deliver a message directly, stamped with from.
Delivery awaits bounded mailbox admission and retains ownership of the message until admission succeeds or the exact event is returned on closure. Sequential sends by one producer retain their order. Cloned references used by concurrent producers have no pre-admission ordering guarantee; their accepted messages may interleave in either order.
§Errors
Returns the event sender’s delivery failure.
Trait Implementations§
Auto Trait Implementations§
impl<A, S, L> Freeze for ActorRef<A, S, L>
impl<A, S, L> RefUnwindSafe for ActorRef<A, S, L>
impl<A, S, L> Send for ActorRef<A, S, L>
impl<A, S, L> Sync for ActorRef<A, S, L>
impl<A, S, L> Unpin for ActorRef<A, S, L>
impl<A, S, L> UnsafeUnpin for ActorRef<A, S, L>
impl<A, S, L> UnwindSafe for ActorRef<A, S, L>
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