fuchsia_async/lib.rs
1// Copyright 2018 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5//! A futures-rs executor designed specifically for Fuchsia.
6//!
7//! # Example:
8//! A simple, singlethreaded print server:
9//!
10//! ```no_run
11//! #[fuchsia_async::run_singlethreaded]
12//! async fn main() {
13//! let op = say_world();
14//!
15//! // This println! will happen first
16//! println!("Hello...");
17//!
18//! // Calling `.await` on `op` starts executing `say_world`.
19//! op.await;
20//! }
21//!
22//!
23//! async fn say_world() {
24//! println!("...world");
25//! }
26//! ```
27
28#![warn(missing_docs)]
29#![warn(clippy::all)]
30#![deny(clippy::await_holding_lock)]
31#![deny(clippy::await_holding_refcell_ref)]
32
33mod runtime;
34pub use self::runtime::*;
35
36mod handle;
37pub use self::handle::channel::{Channel, RecvMsg};
38pub use self::handle::on_signals::OnSignalsRef;
39pub use self::handle::socket::Socket;
40
41/// Asynchronous networking abstractions.
42pub mod net;
43
44#[cfg(target_os = "fuchsia")]
45pub use self::handle::{
46 fifo::{Fifo, FifoEntry},
47 on_interrupt::OnInterrupt,
48 on_signals::OnSignals,
49 rwhandle::{
50 DefaultRWHandleSpec, RWHandle, RWHandleSpec, ReadableHandle, ReadableState, WritableHandle,
51 WritableState,
52 },
53};
54
55#[cfg(target_os = "fuchsia")]
56pub use runtime::instrument;
57
58pub use fuchsia_async_macro::{run, run_singlethreaded, run_until_stalled};
59
60pub mod condition;
61/// Testing support for repeated runs
62pub mod test_support;