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.
45//! 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//! ```
2728#![warn(missing_docs)]
29#![deny(clippy::await_holding_lock)]
30#![deny(clippy::await_holding_refcell_ref)]
3132mod runtime;
33pub use self::runtime::*;
3435mod handle;
36pub use self::handle::channel::{Channel, RecvMsg};
37pub use self::handle::on_signals::OnSignalsRef;
38pub use self::handle::socket::Socket;
3940/// Asynchronous networking abstractions.
41pub mod net;
4243#[cfg(target_os = "fuchsia")]
44pub use self::handle::{
45 fifo::{Fifo, FifoEntry},
46 on_signals::OnSignals,
47 rwhandle::{RWHandle, ReadableHandle, ReadableState, WritableHandle, WritableState},
48};
4950/// An emulation library for Zircon handles on non-Fuchsia platforms.
51#[cfg(not(target_os = "fuchsia"))]
52pub mod emulated_handle {
53pub use super::handle::{
54 shut_down_handles, AsHandleRef, Channel, EmulatedHandleRef, Event, EventPair, Handle,
55 HandleBased, HandleDisposition, HandleInfo, HandleOp, HandleRef, Koid, MessageBuf,
56 MessageBufEtc, ObjectType, Peered, Rights, Signals, Socket, SocketOpts,
57 };
5859/// Type of raw Zircon handles.
60#[allow(non_camel_case_types)]
61pub type zx_handle_t = u32;
62}
6364pub use fuchsia_async_macro::{run, run_singlethreaded, run_until_stalled};
6566pub mod condition;
67/// Testing support for repeated runs
68pub mod test_support;