#[non_exhaustive]
pub struct LivelinessMonitor { pub latest_report: AtomicInstant, }
Expand description

A liveliness monitor for asynchronous runtimes.

Its only constructor (LivelinessMonitor::start()) returns it wrapped in an Arc with strong count 1. Should that strong count reach 0 (due to dropping all the clones you may have made of that Arc, or by using Arc::try_unwrap()), the associated task spawned in your runtime will end next time upon its next scheduling.

Fields (Non-exhaustive)

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
latest_report: AtomicInstant

The instant of the latest liveliness report.

Implementations

Starts a liveliness monitor on your asynchronous runtime (of which you must pass the spawn method), returning both the handle the runtime may have returned, as well as a reference counted LivelinessMonitor.

Please refer to the examples to learn more about its usage.

The instant of the latest liveliness report, as an std::time::Instant.

Keep in mind its resolution is limited to that of crate::support::AtomicDuration, and that a busy executor may provide updates at rather low frequencies.

You can probably expect that if the report hasn’t been updated in the last 5 seconds, your executor is indeed stalled.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.