Crate fuchsia_async

source ·
Expand description

A futures-rs executor design specifically for Fuchsia OS.

Example:

A simple, singlethreaded print server:

#[fuchsia_async::run_singlethreaded]
async fn main() {
    let op = say_world();

    // This println! will happen first
    println!("Hello...");

    // Calling `.await` on `op` starts executing `say_world`.
    op.await;
}


async fn say_world() {
    println!("...world");
}

Modules

A future which can be used by multiple threads at once.
Asynchronous networking abstractions.
Testing support for repeated runs

Macros

invoke_for_handle_types!{mmm} calls the macro mmm! with two arguments: one is the name of a Zircon handle, the second is one of:
Pins a value on the stack.

Structs

An I/O object representing a Channel.
A handle to an executor.
An I/O object representing a Fifo.
An asynchronous interval timer. This is a stream of events resolving at a rate of once-per interval.
A single-threaded port-based executor for Fuchsia OS.
A future that completes when some set of signals become available on a Handle.
A wrapper for a future who’s steady progress is monitored and will complete with the provided closure if no progress is made before the timeout.
A wrapper for a future which will complete with a provided closure when a timeout occurs.
A Handle that receives notifications when it is readable/writable.
ReadEntries represents the future of a single read with multiple entries.
ReadOne represents the future of a single read yielding a single entry.
A registration of a PacketReceiver. When dropped, it will automatically deregister the PacketReceiver.
A future used to receive a message from a channel.
A multi-threaded port-based executor for Fuchsia OS. Requires that tasks scheduled on it implement Send so they can be load balanced between worker threads.
An I/O object representing a Socket.
A handle to a future that is owned and polled by the executor.
A single-threaded executor for testing. Exposes additional APIs for manipulating executor state and validating behavior of executed tasks.
A time relative to the executor’s clock.
An asynchronous timer.
WriteEntries represents the future of one or more writes.

Enums

Indicates whether the executor can run, or is stuck waiting.

Traits

An extension trait to provide after_now on zx::Duration.
Marker trait for types that can be read/written with a Fifo. Unsafe because not all types may be represented by arbitrary bit patterns.
Identifies that the object may be used to read entries from a FIFO.
Identifies that the object may be used to write entries into a FIFO.
A trait for handling the arrival of a packet on a zx::Port.
A trait which allows futures to be easily wrapped in a timeout.
The time when a Timer should wakeup.

Functions

Offload a blocking function call onto a different thread.

Attribute Macros

Define an async function that should run to completion on N threads.
Define an async function that should run to completion on a single thread.
Define an async function that should complete without stalling.