Skip to main content

WaitNotice

Trait WaitNotice 

Source
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§

Source

fn waiting(&mut self)

Called once, when the first attempt finds the lock held.

Provided Methods§

Source

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.

Source

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§

Source§

impl WaitNotice for SilentWait

Waiting silently does nothing.

Source§

impl<Sink: Write> WaitNotice for HolderNotice<Sink>