pub trait Watch {
// Required methods
fn active(&self) -> bool;
fn stopped(&self) -> bool;
fn notice_due_in(&self) -> i64;
fn notice(&self);
fn keep(&self, key: u8);
fn quit(&self);
}Expand description
A COMMAND’s watch over its waits, lent by the program the operator is typing at (the shell).
Why the watch belongs to the caller and not to the wait (audits/2026-10-13-quit-audit.md 7a). A
person waits on a COMMAND, not on one request: a copy of a large file is hundreds of requests that each
answer in milliseconds, and a notice timed per request never fires for it, however long the copy runs. So
the clock, the [q] quit words and the record of whether the operator has quit live in the shell, once per
command, and every wait the command makes reads them. A program that is not at a prompt lends no watch and
gets the plain bounded wait.
The library still knows nothing about consoles: these are questions, and the answers are the caller’s.
Required Methods§
Sourcefn active(&self) -> bool
fn active(&self) -> bool
A command is running. When it is not (between commands, before the first prompt), a wait is plain: nothing is shown and no key is read.
Sourcefn stopped(&self) -> bool
fn stopped(&self) -> bool
The operator has asked to stop. Asked before every request, so a command made of many fast requests stops at the next one - nothing further is sent.
Sourcefn notice_due_in(&self) -> i64
fn notice_due_in(&self) -> i64
Seconds until the command’s notice is due: 0 once it is due or has been shown.
Sourcefn notice(&self)
fn notice(&self)
The notice is due. The watch shows it once per command; a wait may call this more than once.