|
1 | 1 | //! A general purpose crate for working with timeouts and delays with futures.
|
2 | 2 | //!
|
3 | 3 | //! This crate is intended to provide general purpose timeouts and interval
|
4 |
| -//! streams for working with `futures`. The implementation may not be optimized |
5 |
| -//! for your particular use case, though, so be sure to read up on the details |
6 |
| -//! if you're concerned about that! |
| 4 | +//! streams for working with `futures`. |
7 | 5 | //!
|
8 | 6 | //! Basic usage of this crate is relatively simple:
|
9 | 7 | //!
|
|
19 | 17 | //! # }
|
20 | 18 | //! ```
|
21 | 19 | //!
|
22 |
| -//! And you're off to the races! Check out the API documentation for more |
23 |
| -//! details about the various methods on `Delay`. |
24 |
| -//! |
25 |
| -//! # Implementation details |
26 |
| -//! |
27 |
| -//! The `Delay` type is powered by an associated `Timer`. By |
28 |
| -//! default constructors like `Delay::new` use a global |
29 |
| -//! instance of `Timer` to power their usage. This global `Timer` is spawned |
30 |
| -//! onto a helper thread which continuously runs in the background sending out |
31 |
| -//! timer notifications. |
32 |
| -//! |
33 |
| -//! If needed, however, a `Timer` can be constructed manually and the |
34 |
| -//! `Delay::new_handle`-style methods can be used to create delays/intervals |
35 |
| -//! associated with a specific instance of `Timer`. Each `Timer` has a |
36 |
| -//! `TimerHandle` type which is used to associate new objects to it. |
37 |
| -//! |
38 |
| -//! Note that there's also a `TimerHandle::set_fallback` method which will |
39 |
| -//! globally configure the fallback timer handle as well if you'd like to run |
40 |
| -//! your own timer. |
41 |
| -//! |
42 |
| -//! Finally, the implementation of `Timer` itself is currently a binary heap. |
43 |
| -//! Timer insertion is O(log n) where n is the number of active timers, and so |
44 |
| -//! is firing a timer (which invovles removing from the heap). |
| 20 | +//! And you're off to the races! |
45 | 21 |
|
46 | 22 | #![deny(missing_docs)]
|
47 | 23 | #![warn(missing_debug_implementations)]
|
48 | 24 |
|
49 |
| -use arc_list::{ArcList, Node}; |
50 |
| -use heap::{Heap, Slot}; |
51 |
| -use heap_timer::HeapTimer; |
52 |
| -use timer::{Timer, TimerHandle, ScheduledTimer}; |
53 |
| - |
54 |
| -mod heap_timer; |
55 | 25 | mod arc_list;
|
| 26 | +mod delay; |
56 | 27 | mod global;
|
57 | 28 | mod heap;
|
| 29 | +mod heap_timer; |
58 | 30 | mod timer;
|
59 | 31 |
|
60 |
| -mod delay; |
| 32 | +use arc_list::{ArcList, Node}; |
| 33 | +use heap::{Heap, Slot}; |
| 34 | +use heap_timer::HeapTimer; |
| 35 | +use timer::{ScheduledTimer, Timer, TimerHandle}; |
| 36 | + |
61 | 37 | pub use self::delay::Delay;
|
0 commit comments