Crate fuchsia_async

Source
Expand description

A futures-rs executor designed specifically for Fuchsia.

§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§

atomic_future
A future which can be used by multiple threads at once.
condition
Implements a combined mutex and condition.
net
Asynchronous networking abstractions.
scope
Structured concurrency API for fuchsia-async.
test_support
Testing support for repeated runs

Macros§

invoke_for_handle_types
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§

BootInstant
A time relative to the executor’s clock on the boot timeline.
Channel
An I/O object representing a Channel.
EHandle
A handle to an executor.
Fifo
An I/O object representing a Fifo.
Interval
An asynchronous interval timer.
JoinHandle
A handle to a future that is owned and polled by the executor.
LocalExecutor
A single-threaded port-based executor for Fuchsia.
MonotonicInstant
A time relative to the executor’s clock.
OnSignals
A future that completes when some set of signals become available on a Handle.
OnStalled
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.
OnTimeout
A wrapper for a future which will complete with a provided closure when a timeout occurs.
RWHandle
A Handle that receives notifications when it is readable/writable.
ReadEntries
ReadEntries represents the future of a single read with multiple entries.
ReadOne
ReadOne represents the future of a single read yielding a single entry.
ReceiverRegistration
A registration of a PacketReceiver. When dropped, it will automatically deregister the PacketReceiver.
RecvMsg
A future used to receive a message from a channel.
Scope
A scope for managing async tasks. This scope is cancelled when dropped.
ScopeHandle
A handle to a scope, which may be used to spawn tasks.
SendExecutor
A multi-threaded port-based executor for Fuchsia. Requires that tasks scheduled on it implement Send so they can be load balanced between worker threads.
Socket
An I/O object representing a Socket.
Task
This is the same as a JoinHandle, except that the future will be cancelled when the task is dropped.
TaskGroup
Allows the user to spawn multiple Tasks and await them as a unit.
TestExecutor
A single-threaded executor for testing. Exposes additional APIs for manipulating executor state and validating behavior of executed tasks.
Timer
An asynchronous timer.
WriteEntries
WriteEntries represents the future of one or more writes.

Enums§

ReadableState
State of an object when it is ready for reading.
WritableState
State of an object when it is ready for writing.

Traits§

DurationExt
An extension trait to provide after_now on zx::MonotonicDuration.
FifoEntry
Marker trait for types that can be read/written with a Fifo.
FifoReadable
Identifies that the object may be used to read entries from a FIFO.
FifoWritable
Identifies that the object may be used to write entries into a FIFO.
PacketReceiver
A trait for handling the arrival of a packet on a zx::Port.
ReadableHandle
A Handle that receives notifications when it is readable.
TimeoutExt
A trait which allows futures to be easily wrapped in a timeout.
WakeupTime
The time when a Timer should wakeup.
WritableHandle
A Handle that receives notifications when it is writable.

Functions§

unblock
Offload a blocking function call onto a different thread.

Type Aliases§

MonotonicDuration
A duration on the monotonic timeline.
OnSignalsRef
Alias for the common case where OnSignals is used with zx::HandleRef.

Attribute Macros§

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