pub struct RunStateHandle { /* private fields */ }Expand description
Handle the rest of the system uses to talk to the actor.
Cheap to clone — every field is itself Arc-style. The
snapshot side is read with a single atomic load; the inbox
side is fire-and-forget (send returns immediately, dropped
silently if the actor has exited).
Implementations§
Source§impl RunStateHandle
impl RunStateHandle
Sourcepub fn load(&self) -> Arc<RunState> ⓘ
pub fn load(&self) -> Arc<RunState> ⓘ
Load the current snapshot. Always returns the most
recently published Arc<RunState> — the only way for
this to return a stale snapshot is if the actor hasn’t
processed a sent command yet, which is the intended
decoupling.
Sourcepub fn send(&self, cmd: RunStateCmd)
pub fn send(&self, cmd: RunStateCmd)
Send a command into the actor inbox. Fire-and-forget: if the actor has exited, the send is dropped silently. The actor never falls behind in a way that pressures the caller — the caller doesn’t wait for it.
Sourcepub fn flush_frame(&self, timeout: Duration) -> bool
pub fn flush_frame(&self, timeout: Duration) -> bool
Block until the TUI has rendered at least one frame that
reflects every command sent on this handle prior to the
call. Bypasses the TUI’s tick_rate throttle so the
caller doesn’t pay up to a full tick of latency.
Returns true if the round trip completed inside timeout
and false if the TUI didn’t respond (e.g. the app has
already exited or is wedged). Callers should treat a
false as best-effort: the run continues either way.
Sourcepub fn drain_barrier(&self, timeout: Duration) -> bool
pub fn drain_barrier(&self, timeout: Duration) -> bool
Block until the actor has PROCESSED every command sent on
this handle prior to the call (ordered-inbox barrier; no TUI
involvement, so it works on every surface). Best-effort:
false on timeout or a dead actor.
Sourcepub fn frame_sync(&self) -> FrameSync
pub fn frame_sync(&self) -> FrameSync
Access the shared frame-sync surface. The TUI app holds a clone and consumes it from its draw loop.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for RunStateHandle
impl !UnwindSafe for RunStateHandle
impl Freeze for RunStateHandle
impl Send for RunStateHandle
impl Sync for RunStateHandle
impl Unpin for RunStateHandle
impl UnsafeUnpin for RunStateHandle
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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