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::{error,result};
7//!
8//! use traffic_light::future::FutureExt as _;
9//!
10//! fn main() -> result::Result<(), Box<dyn error::Error>> {
11//!     async {
12//!         // ...
13//!         Ok::<(), Box<dyn error::Error>>(())
14//!     }.block_on()?;
15//!
16//!     Ok(())
17//! }
18//! ```
19//!
20//! ```
21//! use std::{error,result};
22//!
23//! use traffic_light::executor::Executor;
24//!
25//! fn main() -> result::Result<(), Box<dyn error::Error>> {
26//!     Executor::block_on(async {
27//!         // ...
28//!         Ok::<(), Box<dyn error::Error>>(())
29//!     })?;
30//!
31//!     Ok(())
32//! }
33//! ```
34
35pub mod executor;
36pub mod future;
37pub mod prelude;
38pub(crate) mod thread;
39
40#[cfg(feature = "macros")]
41pub use traffic_light_macros::main;