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
//! The same `ask`, with no `async`.
//!
//! The blocking [`Ask`] and [`AskIterator`] have the names and the methods of the async traits.
//! They return the answers, not a future. Both modes share [`QuestionSet`](crate::QuestionSet).
//! Thus a program changes one import, from `system2::prelude` to `system2::blocking::prelude`, and
//! removes each `.await`.
//!
//! `.ask` uses the global client, as the async `.ask` does. [`Client`] asks with a given client.
//! Each blocking client has a Tokio runtime with one worker thread. The global client has one
//! runtime for the process.
//!
//! A blocking `ask` in an async runtime panics, and so does a drop of a blocking client there.
//! Tokio cannot start or stop a runtime in a runtime.
//!
//! # Examples
//!
//! ```no_run
//! use system2::blocking::prelude::*;
//!
//! fn main() -> system2::Result<()> {
//! let answer = noul!("Is the ticket urgent?").ask("The site is down.")?;
//! println!("{:.2}", answer.probability());
//! Ok(())
//! }
//! ```
pub use ;
pub use Client;
/// The prelude of the blocking API.
///
/// It is [`system2::prelude`](crate::prelude), with the blocking [`Ask`] and [`AskIterator`] in
/// place of the async traits.