1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! Speak the shep shepherd channel: signal readiness, emit a metric,
//! answer an action. `docs/shepherd-channel.md` has the contract.
//!
//! With no channel, nothing is sent and no handler runs. Registering one
//! still succeeds, so an app needs no branch at its call sites.
//!
//! ```
//! let shepherd = shep_channel::serve();
//!
//! shepherd.on_action("gc", |params, _name| {
//! format!("collected, params={params:?}")
//! });
//! shepherd.on_shutdown(|| { /* stop gracefully */ });
//!
//! // No channel here: this test runs outside shep. See `is_active`.
//! assert!(!shepherd.is_active());
//! shepherd.metric("rps", 4200.0);
//! shepherd.ready().unwrap();
//! ```
//!
//! - A slow handler delays the next message: the reader thread runs
//! handlers itself. `action_timeout` (default 3s) sets the budget.
//! - `metric` drops a sample under backpressure. `ready` and a reply block
//! for room instead, since losing either is worse.
//! - An unhandled shutdown warns on stderr. This crate never stops a
//! process on its own.
// Not `forbid`: `endpoint` needs one `unsafe` block per platform.
// One takes the inherited descriptor on unix; the other peeks a
// Windows pipe's buffer. Each carries its own `// SAFETY:` comment.
pub use Channel;
pub use ;
pub use ;
pub use ChannelError;
pub use ;
pub use ;