Skip to main content

Spawn

Struct Spawn 

Source
pub struct Spawn<'a, A, F>
where A: Actor, F: FnOnce() -> A + Send + 'static,
{ /* private fields */ }
Available on crate feature actor only.
Expand description

A configurable actor spawn operation.

Returned by Cluster::spawn.

Implementations§

Source§

impl<'a, A, F> Spawn<'a, A, F>
where A: Actor, F: FnOnce() -> A + Send + 'static,

Source

pub fn with_name(self, name: impl Into<Cow<'static, str>>) -> Spawn<'a, A, F>

Registers the actor under name after startup succeeds.

Source

pub fn with_capacity(self, capacity: NonZero<usize>) -> Spawn<'a, A, F>

Sets the actor’s bounded mailbox capacity.

Source

pub fn with_supervisor<S>(self, supervisor: &Mailbox<S>) -> Spawn<'a, A, F>

Sends actor lifecycle events to supervisor.

Trait Implementations§

Source§

impl<A, F> IntoFuture for Spawn<'_, A, F>
where A: Actor, F: FnOnce() -> A + Send + 'static,

Source§

type IntoFuture = SpawnFuture<A>

Which kind of future are we turning this into?
Source§

type Output = Result<(Mailbox<A>, ActorHandle<<A as Actor>::Error>), SpawnError<<A as Actor>::Error>>

The output that the future will produce on completion.
Source§

fn into_future(self) -> <Spawn<'_, A, F> as IntoFuture>::IntoFuture

Creates a future from a value. Read more

Auto Trait Implementations§

§

impl<'a, A, F> !RefUnwindSafe for Spawn<'a, A, F>

§

impl<'a, A, F> !UnwindSafe for Spawn<'a, A, F>

§

impl<'a, A, F> Freeze for Spawn<'a, A, F>
where F: Freeze, <A as Actor>::Arguments: Freeze, Option<Supervision<A>>: Freeze,

§

impl<'a, A, F> Send for Spawn<'a, A, F>
where <A as Actor>::Arguments: Send, Option<Supervision<A>>: Send,

§

impl<'a, A, F> Sync for Spawn<'a, A, F>
where F: Sync, <A as Actor>::Arguments: Sync, Option<Supervision<A>>: Sync,

§

impl<'a, A, F> Unpin for Spawn<'a, A, F>
where F: Unpin, <A as Actor>::Arguments: Unpin, Option<Supervision<A>>: Unpin,

§

impl<'a, A, F> UnsafeUnpin for Spawn<'a, A, F>
where F: UnsafeUnpin, <A as Actor>::Arguments: UnsafeUnpin, Option<Supervision<A>>: UnsafeUnpin,

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Message for T
where T: Send + 'static,

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
§

impl<T> Ungil for T
where T: Send,

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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