timer_deque_rs/lib.rs
1/*-
2 * timer-rs - a Rust crate which provides timer and timer queues based on target OS
3 * functionality.
4 *
5 * Copyright (C) 2025 Aleksandr Morozov
6 *
7 * The timer-rs crate can be redistributed and/or modified
8 * under the terms of either of the following licenses:
9 *
10 * 1. the Mozilla Public License Version 2.0 (the “MPL”) OR
11 *
12 * 2. EUROPEAN UNION PUBLIC LICENCE v. 1.2 EUPL © the European Union 2007, 2016
13 */
14
15pub extern crate nix;
16pub extern crate bitflags;
17pub extern crate chrono;
18pub extern crate rand;
19
20/// All code which should be ported to the specific OS. Contains a system timer
21/// implementation and poll.
22pub mod timer_portable;
23
24/// Crates error handling.
25pub mod error;
26
27/// Common things.
28pub mod common;
29
30/// A `consumer` type of the timer which consumes the intance and returns it when
31/// timer triggers. The `consumed` instance normally whould be [Send] because it will
32/// be moved into the timer.
33pub mod timer_consumer;
34
35/// A `ticket` issuer. Issues a ticket which should be assigned to the instance whcih was added
36/// to the timer's queue. The `ticket` can be used to remove the item from queue before the
37/// timeout event. If ticket is dropped i.e connection closed, the ticket will be
38/// in timer's queue until timeout where it will be ignored on timeout event.
39pub mod timer_tickets;
40
41/// A `signal` sender. Calls the specified callback which must never block the executing thread.
42pub mod timer_signal;
43
44/// A base implementation of the sorted timer queue.
45pub mod timer;
46
47pub use crate::timer::OrderedTimerDeque;
48
49pub use crate::timer_consumer::TimerDequeueConsumer;
50pub use crate::timer_signal::{TimerDequeueSignal, TimerDequeueSignalTicket};
51pub use crate::timer_tickets::{TimerDequeueTicketIssuer, TimerDequeueTicket, TimerDequeueId};
52pub use crate::timer_portable::TimerReadRes;