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
61
62
//! # ⏳ time-lib
//!
//! Rust library to manange time.
//!
//! The core concept is the [`Timer`], which contains information
//! about the cycle and the state. The [`Server`] runs the timer and
//! accepts connection from [`Client`]s using [`ServerBind`]ers. The
//! clients communicate with the server using [`Request`]s and
//! [`Response`]s, which allow them to control the timer. The timer
//! can be customized using [`TimerConfig`] and [`TimerCycle`].
//!
//! ```text,ignore
//! ┌────────────────────────┐
//! │Server                  │
//! │             ┌────────┐ │ Request ┌────────┐
//! │             │        │◄├─────────┤        │
//! │    ┌────────┤Binder A│ │         │Client A│
//! │    │        │        ├─┼────────►│        │
//! │    │        └────────┘ │Response └────────┘
//! │    │                   │
//! │    ▼        ┌────────┐ │         ┌────────┐
//! │ ┌─────┐     │        │◄├─────────┤        │
//! │ │Timer│◄────┤Binder B│ │         │Client B│
//! │ └─────┘     │        ├─┼────────►│        │
//! │    ▲        └────────┘ │         └────────┘
//! │    │                   │
//! │    │        ┌────────┐ │         ┌────────┐
//! │    │        │        │◄├─────────┤        │
//! │    └────────┤Binder C│ │         │Client C│
//! │             │        ├─┼────────►│        │
//! │             └────────┘ │         └────────┘
//! │                        │
//! └────────────────────────┘
//! ```
//!
//! Example using TCP and the [Pomodoro] technique:
//!
//! ```shell,ignore
//! $ cargo run --example pomodoro-tcp
//! ```
//!
//! ```rust,ignore
#![doc = include_str!("../examples/pomodoro-tcp.rs")]
//! ```
//!
//! See [more examples].
//!
//! [Pomodoro]: https://en.wikipedia.org/wiki/Pomodoro_Technique
//! [more examples]: https://git.sr.ht/~soywod/pimalaya/tree/master/item/time/examples

#![cfg_attr(docsrs, feature(doc_auto_cfg))]

#[cfg(feature = "client")]
pub mod client;
pub(crate) mod handler;
pub mod request;
pub mod response;
#[cfg(feature = "server")]
pub mod server;
#[cfg(feature = "tcp-any")]
pub mod tcp;
pub mod timer;