Skip to main content

ActorRef

Struct ActorRef 

Source
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>

Source

pub const fn address(&self) -> &A

The destination address.

Source§

impl<A, S, L> ActorRef<A, S, L>
where A: Address + Send + Sync, S: EventSender + Sync, <S as EventSender>::Event: UserEvent<Addr = A>, <<S as EventSender>::Event as UserEvent>::Message: Send, L: Sync,

Source

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§

Source§

impl<A, S, L> Clone for ActorRef<A, S, L>
where A: Clone, S: Clone, L: Clone,

Source§

fn clone(&self) -> ActorRef<A, S, L>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<A, S, L> Freeze for ActorRef<A, S, L>
where A: Freeze, S: Freeze, L: Freeze,

§

impl<A, S, L> RefUnwindSafe for ActorRef<A, S, L>

§

impl<A, S, L> Send for ActorRef<A, S, L>
where A: Send, S: Send, L: Send,

§

impl<A, S, L> Sync for ActorRef<A, S, L>
where A: Sync, S: Sync, L: Sync,

§

impl<A, S, L> Unpin for ActorRef<A, S, L>
where A: Unpin, S: Unpin, L: Unpin,

§

impl<A, S, L> UnsafeUnpin for ActorRef<A, S, L>

§

impl<A, S, L> UnwindSafe for ActorRef<A, S, L>
where A: UnwindSafe, S: UnwindSafe, L: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.