Skip to main content

WaitNotice

Trait WaitNotice 

Source
pub trait WaitNotice {
    // Required method
    fn waiting(&mut self);

    // Provided method
    fn slow(&mut self, _waited: Duration) { ... }
}
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 once, when the wait has lasted SLOW_WAIT, with how long it has lasted. Brief contention never reaches it; a notice that only needs the first moment ignores it.

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>