Skip to main content

System

Struct System 

Source
pub struct System<R, L = NoLifecycle> { /* private fields */ }
Expand description

Tokio-backed actor execution boundary with shared typed routing.

Implementations§

Source§

impl<R> System<R>

Source

pub const fn new(mailbox: MailboxConfig, router: R) -> System<R>

Construct a Tokio-backed system from its communication configuration and router.

Source

pub const fn with_lifecycle<S>( mailbox: MailboxConfig, router: R, lifecycle: S, ) -> System<R, Lifecycle<S>>

Construct a Tokio-backed system with a statically dispatched lifecycle sink.

Source§

impl<R, L> System<R, L>
where R: Clone, L: Clone,

Source

pub async fn activate<B>( &self, address: <B as Behavior>::Addr, behavior: B, ) -> Result<RootActivation<B, RootRetirement<ActorRef<<B as Behavior>::Addr, MailboxSender<<B as Behavior>::Event>, <L as LifecycleFactory<<B as Behavior>::Addr, <R as EndpointRegistry<<B as Behavior>::Addr, <B as Behavior>::Msg, IncarnationEndpoint<<B as Behavior>::Addr, ActorRef<<B as Behavior>::Addr, MailboxAnchor<<B as Behavior>::Event>>>>>::Registration>>::Reporter>, Result<RunExit<Exit<<B as Behavior>::Addr>>, RunError<<B as Behavior>::Error, <ActorEnvironment<B, MailboxReceiver<<B as Behavior>::Event>, R, <<B as Behavior>::Birth as RuntimeBirthMode<<B as Behavior>::Addr, System<R, L>, MailboxAnchor<<B as Behavior>::Event>>>::Runtime, MailboxAnchor<<B as Behavior>::Event>, NoParent> as Environment>::Error>>>>, SystemBirthError<<R as EndpointRegistry<<B as Behavior>::Addr, <B as Behavior>::Msg, IncarnationEndpoint<<B as Behavior>::Addr, ActorRef<<B as Behavior>::Addr, MailboxAnchor<<B as Behavior>::Event>>>>>::Error, <B as Behavior>::Error, <ActorEnvironment<B, MailboxReceiver<<B as Behavior>::Event>, R, <<B as Behavior>::Birth as RuntimeBirthMode<<B as Behavior>::Addr, System<R, L>, MailboxAnchor<<B as Behavior>::Event>>>::Runtime, MailboxAnchor<<B as Behavior>::Event>, NoParent> as Environment>::Error>>
where B: Behavior<Ph = Never> + Send + 'static, <B as Behavior>::Addr: Send + Sync + 'static, <<B as Behavior>::Addr as Address>::Nonce: Send + 'static, <B as Behavior>::Sends: RouteSends<<B as Behavior>::Addr, IncarnationEffects<R, <<B as Behavior>::Addr as Address>::Nonce, <<<B as Behavior>::Birth as RuntimeBirthMode<<B as Behavior>::Addr, System<R, L>, MailboxAnchor<<B as Behavior>::Event>>>::Runtime as ChildRuntime<<B as Behavior>::Addr, <<B as Behavior>::Birth as BirthMode>::Child, MailboxAnchor<<B as Behavior>::Event>>>::Lease, MailboxAnchor<<B as Behavior>::Event>, NoParent, <B as Behavior>::Addr>> + ObservesCreations<<<B as Behavior>::Addr as Address>::Nonce> + Send + 'static, <<B as Behavior>::Sends as RouteSends<<B as Behavior>::Addr, IncarnationEffects<R, <<B as Behavior>::Addr as Address>::Nonce, <<<B as Behavior>::Birth as RuntimeBirthMode<<B as Behavior>::Addr, System<R, L>, MailboxAnchor<<B as Behavior>::Event>>>::Runtime as ChildRuntime<<B as Behavior>::Addr, <<B as Behavior>::Birth as BirthMode>::Child, MailboxAnchor<<B as Behavior>::Event>>>::Lease, MailboxAnchor<<B as Behavior>::Event>, NoParent, <B as Behavior>::Addr>>>::Error: Send + Sync + 'static, <B as Behavior>::Birth: RuntimeBirthMode<<B as Behavior>::Addr, System<R, L>, MailboxAnchor<<B as Behavior>::Event>> + 'static, <<B as Behavior>::Birth as BirthMode>::Child: Send + 'static, <<B as Behavior>::Birth as RuntimeBirthMode<<B as Behavior>::Addr, System<R, L>, MailboxAnchor<<B as Behavior>::Event>>>::Runtime: Send + Sync + 'static, <<<B as Behavior>::Birth as RuntimeBirthMode<<B as Behavior>::Addr, System<R, L>, MailboxAnchor<<B as Behavior>::Event>>>::Runtime as ChildRuntime<<B as Behavior>::Addr, <<B as Behavior>::Birth as BirthMode>::Child, MailboxAnchor<<B as Behavior>::Event>>>::Error: CreationFailure + Send + Sync + 'static, <B as Behavior>::Event: ShutdownEvent + TimeEvent + Send + 'static, <B as Behavior>::Msg: Send + 'static, <B as Behavior>::Error: Send + Sync + 'static, R: Clone + EndpointRegistry<<B as Behavior>::Addr, <B as Behavior>::Msg, IncarnationEndpoint<<B as Behavior>::Addr, ActorRef<<B as Behavior>::Addr, MailboxAnchor<<B as Behavior>::Event>>>> + Send + Sync + 'static, <R as EndpointRegistry<<B as Behavior>::Addr, <B as Behavior>::Msg, IncarnationEndpoint<<B as Behavior>::Addr, ActorRef<<B as Behavior>::Addr, MailboxAnchor<<B as Behavior>::Event>>>>>::Registration: Send + 'static, L: LifecycleFactory<<B as Behavior>::Addr, <R as EndpointRegistry<<B as Behavior>::Addr, <B as Behavior>::Msg, IncarnationEndpoint<<B as Behavior>::Addr, ActorRef<<B as Behavior>::Addr, MailboxAnchor<<B as Behavior>::Event>>>>>::Registration>,

Initialize, register, and launch one exact root incarnation transactionally.

§Errors

Preserves initialization-fold, initialization-effect, and registration failures as separate variants. No endpoint is registered when either initialization stage fails.

Source

pub fn spawn<B>( &self, address: <B as Behavior>::Addr, behavior: B, ) -> Result<Handle<ActorRef<<B as Behavior>::Addr, MailboxSender<<B as Behavior>::Event>, <L as LifecycleFactory<<B as Behavior>::Addr, <R as EndpointRegistry<<B as Behavior>::Addr, <B as Behavior>::Msg, IncarnationEndpoint<<B as Behavior>::Addr, ActorRef<<B as Behavior>::Addr, MailboxAnchor<<B as Behavior>::Event>>>>>::Registration>>::Reporter>, Result<RunExit<Exit<<B as Behavior>::Addr>>, RunError<<B as Behavior>::Error, <ActorEnvironment<B, MailboxReceiver<<B as Behavior>::Event>, R, <<B as Behavior>::Birth as RuntimeBirthMode<<B as Behavior>::Addr, System<R, L>, MailboxAnchor<<B as Behavior>::Event>>>::Runtime, MailboxAnchor<<B as Behavior>::Event>, NoParent> as Environment>::Error>>>, <R as EndpointRegistry<<B as Behavior>::Addr, <B as Behavior>::Msg, IncarnationEndpoint<<B as Behavior>::Addr, ActorRef<<B as Behavior>::Addr, MailboxAnchor<<B as Behavior>::Event>>>>>::Error>
where B: Behavior<Ph = Never> + Send + 'static, <B as Behavior>::Addr: Send + Sync + 'static, <<B as Behavior>::Addr as Address>::Nonce: Send + 'static, <B as Behavior>::Sends: RouteSends<<B as Behavior>::Addr, IncarnationEffects<R, <<B as Behavior>::Addr as Address>::Nonce, <<<B as Behavior>::Birth as RuntimeBirthMode<<B as Behavior>::Addr, System<R, L>, MailboxAnchor<<B as Behavior>::Event>>>::Runtime as ChildRuntime<<B as Behavior>::Addr, <<B as Behavior>::Birth as BirthMode>::Child, MailboxAnchor<<B as Behavior>::Event>>>::Lease, MailboxAnchor<<B as Behavior>::Event>, NoParent, <B as Behavior>::Addr>> + ObservesCreations<<<B as Behavior>::Addr as Address>::Nonce> + Send + 'static, <<B as Behavior>::Sends as RouteSends<<B as Behavior>::Addr, IncarnationEffects<R, <<B as Behavior>::Addr as Address>::Nonce, <<<B as Behavior>::Birth as RuntimeBirthMode<<B as Behavior>::Addr, System<R, L>, MailboxAnchor<<B as Behavior>::Event>>>::Runtime as ChildRuntime<<B as Behavior>::Addr, <<B as Behavior>::Birth as BirthMode>::Child, MailboxAnchor<<B as Behavior>::Event>>>::Lease, MailboxAnchor<<B as Behavior>::Event>, NoParent, <B as Behavior>::Addr>>>::Error: Send + Sync + 'static, <B as Behavior>::Birth: RuntimeBirthMode<<B as Behavior>::Addr, System<R, L>, MailboxAnchor<<B as Behavior>::Event>> + 'static, <<B as Behavior>::Birth as BirthMode>::Child: Send + 'static, <<B as Behavior>::Birth as RuntimeBirthMode<<B as Behavior>::Addr, System<R, L>, MailboxAnchor<<B as Behavior>::Event>>>::Runtime: Send + Sync + 'static, <<<B as Behavior>::Birth as RuntimeBirthMode<<B as Behavior>::Addr, System<R, L>, MailboxAnchor<<B as Behavior>::Event>>>::Runtime as ChildRuntime<<B as Behavior>::Addr, <<B as Behavior>::Birth as BirthMode>::Child, MailboxAnchor<<B as Behavior>::Event>>>::Error: CreationFailure + Send + Sync + 'static, <B as Behavior>::Event: TimeEvent + Send + 'static, <B as Behavior>::Msg: Send + 'static, <B as Behavior>::Error: Send + Sync + 'static, R: Clone + EndpointRegistry<<B as Behavior>::Addr, <B as Behavior>::Msg, IncarnationEndpoint<<B as Behavior>::Addr, ActorRef<<B as Behavior>::Addr, MailboxAnchor<<B as Behavior>::Event>>>> + Send + Sync + 'static, <R as EndpointRegistry<<B as Behavior>::Addr, <B as Behavior>::Msg, IncarnationEndpoint<<B as Behavior>::Addr, ActorRef<<B as Behavior>::Addr, MailboxAnchor<<B as Behavior>::Event>>>>>::Registration: Send + 'static, L: LifecycleFactory<<B as Behavior>::Addr, <R as EndpointRegistry<<B as Behavior>::Addr, <B as Behavior>::Msg, IncarnationEndpoint<<B as Behavior>::Addr, ActorRef<<B as Behavior>::Addr, MailboxAnchor<<B as Behavior>::Event>>>>>::Registration>,

Construct and spawn one behavior actor.

§Errors

Returns endpoint-registration failure, including address collision.

§Panics

Panics if called outside a Tokio runtime, or if a freshly allocated private Bombay Observe namespace cannot resolve the subject registered immediately beforehand.

Trait Implementations§

Source§

impl<R, L> Clone for System<R, L>
where R: Clone, L: Clone,

Source§

fn clone(&self) -> System<R, 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<R, L> Freeze for System<R, L>
where R: Freeze, L: Freeze,

§

impl<R, L> RefUnwindSafe for System<R, L>

§

impl<R, L> Send for System<R, L>
where R: Send, L: Send,

§

impl<R, L> Sync for System<R, L>
where R: Sync, L: Sync,

§

impl<R, L> Unpin for System<R, L>
where R: Unpin, L: Unpin,

§

impl<R, L> UnsafeUnpin for System<R, L>
where R: UnsafeUnpin, L: UnsafeUnpin,

§

impl<R, L> UnwindSafe for System<R, L>
where R: 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.