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§
- Boot
Instant - 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.
- Join
Handle - A handle to a future that is owned and polled by the executor.
- Local
Executor - A single-threaded port-based executor for Fuchsia.
- Monotonic
Instant - 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. - Read
Entries - ReadEntries represents the future of a single read with multiple entries.
- ReadOne
- ReadOne represents the future of a single read yielding a single entry.
- Receiver
Registration - A registration of a
PacketReceiver
. When dropped, it will automatically deregister thePacketReceiver
. - RecvMsg
- A future used to receive a message from a channel.
- Scope
- A scope for managing async tasks. This scope is cancelled when dropped.
- Scope
Handle - A handle to a scope, which may be used to spawn tasks.
- Send
Executor - 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.
- Task
Group - Allows the user to spawn multiple Tasks and await them as a unit.
- Test
Executor - A single-threaded executor for testing. Exposes additional APIs for manipulating executor state and validating behavior of executed tasks.
- Timer
- An asynchronous timer.
- Write
Entries - WriteEntries represents the future of one or more writes.
Enums§
- Readable
State - State of an object when it is ready for reading.
- Writable
State - State of an object when it is ready for writing.
Traits§
- Duration
Ext - An extension trait to provide
after_now
onzx::MonotonicDuration
. - Fifo
Entry - Marker trait for types that can be read/written with a
Fifo
. - Fifo
Readable - Identifies that the object may be used to read entries from a FIFO.
- Fifo
Writable - Identifies that the object may be used to write entries into a FIFO.
- Packet
Receiver - A trait for handling the arrival of a packet on a
zx::Port
. - Readable
Handle - A
Handle
that receives notifications when it is readable. - Timeout
Ext - A trait which allows futures to be easily wrapped in a timeout.
- Wakeup
Time - The time when a Timer should wakeup.
- Writable
Handle - A
Handle
that receives notifications when it is writable.
Functions§
- unblock
- Offload a blocking function call onto a different thread.
Type Aliases§
- Monotonic
Duration - A duration on the monotonic timeline.
- OnSignals
Ref - Alias for the common case where OnSignals is used with zx::HandleRef.
Attribute Macros§
- run
- Define an
async
function that should run to completion onN
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.