Skip to main content

traffic_light/
lib.rs

1//! Another single-threaded block asynchronous executor for Rust.
2//!
3//! # Examples
4//!
5//! ```
6//! use std::{
7//!     error,
8//!     result
9//! };
10//!
11//! use traffic_light::future::FutureExt as _;
12//!
13//! fn main() -> result::Result<(), Box<dyn error::Error>> {
14//!     async {
15//!         // ...
16//!         Ok::<(), Box<dyn error::Error>>(())
17//!     }.block_on()?;
18//!
19//!     Ok(())
20//! }
21//! ```
22//!
23//! ```
24//! use std::{
25//!     error,
26//!     result
27//! };
28//!
29//! use traffic_light::executor::Executor;
30//!
31//! fn main() -> result::Result<(), Box<dyn error::Error>> {
32//!     Executor::block_on(async {
33//!         // ...
34//!         Ok::<(), Box<dyn error::Error>>(())
35//!     })?;
36//!
37//!     Ok(())
38//! }
39//! ```
40
41pub mod executor;
42pub mod future;
43pub mod prelude;
44pub(crate) mod thread;
45
46#[cfg(feature = "macros")]
47pub use traffic_light_macros::main;