time/
lib.rs

1//! # ⏳ time-lib
2//!
3//! Rust library to manange time.
4//!
5//! The core concept is the [`Timer`], which contains information
6//! about the cycle and the state. The [`Server`] runs the timer and
7//! accepts connection from [`Client`]s using [`ServerBind`]ers. The
8//! clients communicate with the server using [`Request`]s and
9//! [`Response`]s, which allow them to control the timer. The timer
10//! can be customized using [`TimerConfig`] and [`TimerCycle`].
11//!
12//! ```text,ignore
13//! ┌────────────────────────┐
14//! │Server                  │
15//! │             ┌────────┐ │ Request ┌────────┐
16//! │             │        │◄├─────────┤        │
17//! │    ┌────────┤Binder A│ │         │Client A│
18//! │    │        │        ├─┼────────►│        │
19//! │    │        └────────┘ │Response └────────┘
20//! │    │                   │
21//! │    ▼        ┌────────┐ │         ┌────────┐
22//! │ ┌─────┐     │        │◄├─────────┤        │
23//! │ │Timer│◄────┤Binder B│ │         │Client B│
24//! │ └─────┘     │        ├─┼────────►│        │
25//! │    ▲        └────────┘ │         └────────┘
26//! │    │                   │
27//! │    │        ┌────────┐ │         ┌────────┐
28//! │    │        │        │◄├─────────┤        │
29//! │    └────────┤Binder C│ │         │Client C│
30//! │             │        ├─┼────────►│        │
31//! │             └────────┘ │         └────────┘
32//! │                        │
33//! └────────────────────────┘
34//! ```
35//!
36//! Example using TCP and the [Pomodoro] technique:
37//!
38//! ```shell,ignore
39//! $ cargo run --example pomodoro-tcp
40//! ```
41//!
42//! ```rust,ignore
43#![doc = include_str!("../examples/pomodoro-tcp.rs")]
44//! ```
45//!
46//! See [more examples].
47//!
48//! [Pomodoro]: https://en.wikipedia.org/wiki/Pomodoro_Technique
49//! [more examples]: https://git.sr.ht/~soywod/pimalaya/tree/master/item/time/examples
50
51#![cfg_attr(docsrs, feature(doc_auto_cfg))]
52
53#[cfg(feature = "client")]
54pub mod client;
55pub(crate) mod handler;
56pub mod request;
57pub mod response;
58#[cfg(feature = "server")]
59pub mod server;
60#[cfg(feature = "tcp-any")]
61pub mod tcp;
62pub mod timer;