pub(crate) struct ThreadStatus {
stop: Arc<Stop>,
state: Snapshot<WorldState>,
own: SnapshotReader<WorldState>,
}Expand description
A cloneable view of a world’s state.
A WorldThread owns the join handle and stops its thread on drop;
this shares only the stop signal and the state, so a
WorldHandle can report a world’s state and
ask it to stop without owning the thread. A caller reads that state through
the handle, so this stays an implementation detail of the spawn functions.
Fields§
§stop: Arc<Stop>The stop signal, sent on drop.
state: Snapshot<WorldState>What the world is doing, and how it ended.
own: SnapshotReader<WorldState>This status’s own reading of the state, for the tests that ask it directly instead of taking a reader.
Implementations§
Source§impl ThreadStatus
impl ThreadStatus
Sourcepub(crate) fn threaded(stop: Arc<Stop>) -> Self
pub(crate) fn threaded(stop: Arc<Stop>) -> Self
A status for a world on a thread of its own, running from here.
Sourcepub(crate) fn detached() -> Self
pub(crate) fn detached() -> Self
A status for a world that shares its owner’s thread.
Such a world - a sub-world on the host, a runner of the caller’s own -
ends when its owner says so, so the state stays
WorldState::Running until then, and the stop signal belongs to
that owner alone.
fn at(stop: Arc<Stop>) -> Self
Sourcepub(crate) fn state(&self) -> SnapshotReader<WorldState>
pub(crate) fn state(&self) -> SnapshotReader<WorldState>
A reader of the state this world publishes.
Every reader sees the newest state, so one that arrives late still learns how the world ended.
Sourcepub(crate) fn is_finished(&self) -> bool
pub(crate) fn is_finished(&self) -> bool
Whether the world has stopped or died.
A detached thread keeps reporting its own end, so this stays
meaningful after WorldThread::detach.
Sourcepub(crate) fn stop_requested(&self) -> bool
pub(crate) fn stop_requested(&self) -> bool
Whether the world has been asked to stop.
A world on its own thread reads this from its tick loop; a world the host drives reads it when the host drains it.
Sourcepub(crate) fn finish(&self)
pub(crate) fn finish(&self)
Mark the world as finished.
A world on its own thread marks itself when its loop ends; a stepped
world’s host calls this when its tick returns false, and a world
dropped by its owner marks itself as it goes. A world that has already
ended keeps the state it ended with: a panic stays the last word.
Sourcepub(crate) fn record_panic(&self, message: String)
pub(crate) fn record_panic(&self, message: String)
Record the panic that ended the world, message and all.
Trait Implementations§
Auto Trait Implementations§
impl Forget for ThreadStatus
impl Freeze for ThreadStatus
impl RefUnwindSafe for ThreadStatus
impl Send for ThreadStatus
impl Sync for ThreadStatus
impl Unpin for ThreadStatus
impl UnsafeUnpin for ThreadStatus
impl UnwindSafe for ThreadStatus
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,
impl<T> Component for Twhere
T: 'static,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
impl<T> MaybeSync for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> SerializableAny for T
§impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.