pub struct ActorHandle {
pub actor_id: AgentId,
/* private fields */
}Expand description
Handle to a spawned actor thread.
The learner uses ActorHandle::send_broadcast /
ActorHandle::send_shutdown; the orchestrating caller consumes the
handle with ActorHandle::join after learner_loop returns.
Fields§
§actor_id: AgentIdWhich actor this handle controls.
Implementations§
Source§impl ActorHandle
impl ActorHandle
Sourcepub fn send_broadcast(&self, broadcast: PolicyBroadcast) -> bool
pub fn send_broadcast(&self, broadcast: PolicyBroadcast) -> bool
Send a policy broadcast to this actor. Returns false when the
actor has already exited (its receiver is disconnected).
Sourcepub fn send_shutdown(&self)
pub fn send_shutdown(&self)
Ask this actor to shut down (best-effort; a dead actor is fine).
Sourcepub fn join(self) -> Result<ActorStats>
pub fn join(self) -> Result<ActorStats>
Wait for the actor thread to exit and return its stats.
§Errors
Returns an error when the actor thread panicked or itself returned an error (e.g. a malformed policy broadcast).
Auto Trait Implementations§
impl !RefUnwindSafe for ActorHandle
impl !UnwindSafe for ActorHandle
impl Freeze for ActorHandle
impl Send for ActorHandle
impl Sync for ActorHandle
impl Unpin for ActorHandle
impl UnsafeUnpin for ActorHandle
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> 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