futures_bounded/
lib.rs

1mod delay;
2mod futures_map;
3mod futures_set;
4mod futures_tuple_set;
5mod stream_map;
6mod stream_set;
7
8pub use delay::Delay;
9pub use futures_map::FuturesMap;
10pub use futures_set::FuturesSet;
11pub use futures_tuple_set::FuturesTupleSet;
12pub use stream_map::StreamMap;
13pub use stream_set::StreamSet;
14
15use std::fmt;
16use std::fmt::Formatter;
17use std::time::Duration;
18
19/// A future failed to complete within the given timeout.
20#[derive(Debug)]
21pub struct Timeout {
22    limit: Duration,
23}
24
25impl Timeout {
26    fn new(duration: Duration) -> Self {
27        Self { limit: duration }
28    }
29}
30
31impl fmt::Display for Timeout {
32    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
33        write!(f, "future failed to complete within {:?}", self.limit)
34    }
35}
36
37/// Error of a future pushing
38#[derive(PartialEq, Debug)]
39pub enum PushError<T> {
40    /// The length of the set is equal to the capacity
41    BeyondCapacity(T),
42    /// The map already contained an item with this key.
43    ///
44    /// The old item is returned.
45    Replaced(T),
46}
47
48impl std::error::Error for Timeout {}