futures_bounded/
lib.rs

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