pub trait WaitNotice {
// Required method
fn waiting(&mut self);
// Provided methods
fn slow(&mut self, _waited: Duration) { ... }
fn announces_at_start(&self) -> bool { ... }
}Expand description
What:
Something told once that an acquirer has to wait,
such as a stderr notice.
A trait is an interface a type implements.
Why:
A waiter may tell the user whose lock it waits for;
the lock module stays silent.
In TS you’d write (pseudocode):
type OnWait = () => void;Required Methods§
Provided Methods§
Sourcefn slow(&mut self, _waited: Duration)
fn slow(&mut self, _waited: Duration)
Called when the wait has lasted the cadence’s grace, and again at every interval after it, with how long the wait has lasted. Brief contention never reaches it; a notice that only needs the first moment ignores it.
Sourcefn announces_at_start(&self) -> bool
fn announces_at_start(&self) -> bool
Whether waiting already said so out loud,
so the first slow call comes one interval after the start instead of after the grace.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl WaitNotice for SilentWait
Waiting silently does nothing.