Struct vigil::Vigil

source ·
pub struct Vigil { /* private fields */ }
Expand description

Represents a single vigil over the code. Should be notified every tick_interval, if enough intervals pass without a notification the callback will be fired (on a separate thread).

Implementations§

Create a new vigil object. The three callbacks are all optional. Note that no callbacks will be fired until the first notification has occurred (this allows the vigil to be created ahead of the worker thread without causing spurious logs/callbacks).

Indicate to the vigil that the code is still active and alive. This should be done in the same thread that is actively processing work (e.g. not in a dedicated notifier thread) otherwise deadlocks will not be caught. If the processing thread knows it will be unavailable to notify for an extended period of time, it should use set_interval rather than faking up notifications.

Change the interval between expected notifications. Useful if a worker thread is expecting to block on a long operation (e.g. a blocking HTTP request, or a CPU intensive calculation). This interval will be changed until set_interval is called again (so code should shorten the interval once the long-blocking work is completed).

Trait Implementations§

Executes the destructor for this type. Read more

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.