1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// MIT/Apache2 License
//! This crate provides the [`BlockingDisplay`] and [`BlockingDisplayImmut`] objects, which allow the user to
//! convert a `breadx::Display` into a `breadx::AsyncDisplay`.
//!
//! Occasionally, you have an object that implements `breadx::Display` that you need to implement
//! `breadx::AsyncDisplay`. Although the `*Display` objects in `breadx` can be easily changed to implement
//! `breadx::AsyncDisplay` by changing the `Connection` to an `AsyncConnection`, `Display` implementations
//! outside of `breadx` may not share this guarantee.
//!
//! `BlockingDisplay<T>` implements `AsyncDisplay` when `T` implements `Display`. `BlockingDisplayImmut<T>`
//! implements `AsyncDisplay` and `&AsyncDisplay` when `T` implements `&Display`.
//!
//! This is implemented on the [`blocking`] thread-pool when the `tokio` feature is not enabled, and is
//! implemented via [`spawn_blocking`] when it is.
//!
//! [`blocking`]: https://crates.io/crates/blocking
//! [`spawn_blocking`]: https://docs.rs/tokio/1.9.0/tokio/task/fn.spawn_blocking.html
//#[cfg(any(feature = "immutable", not(feature = "tokio")))]
use Future;
//#[cfg(feature = "immutable")]
//use std::task::{Context, Poll};
pub use BlockingDisplay;
//#[cfg(feature = "immutable")]
//mod immutable;
//#[cfg(feature = "immutable")]
//pub use immutable::BlockingDisplayImmut;
pub
pub async
/*#[cfg(feature = "immutable")]
pub(crate) fn now_or_never<R>(f: impl Future<Output = R>) -> Option<R> {
// pin future on stack
pin_utils::pin_mut!(f);
// create context
let waker = noop_waker::noop_waker();
let mut ctx = Context::from_waker(&waker);
// poll future
match f.poll(&mut ctx) {
Poll::Ready(out) => Some(out),
Poll::Pending => None,
}
}*/