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:

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.
  • Allows the user to spawn multiple Tasks and await them as a unit.
  • 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§

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 Handle that receives notifications when it is readable.
  • A trait which allows futures to be easily wrapped in a timeout.
  • The time when a Timer should wakeup.
  • A Handle that receives notifications when it is writable.

Functions§

  • Offload a blocking function call onto a different thread.

Type Aliases§

  • Alias for the common case where OnSignals is used with zx::HandleRef.

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.