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§
- 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
. - Spawnable
Future SpawnableFuture
is a boxed future that can be spawned without incurring any more allocations i.e. it doesn’t end up with the double boxing that you end up with if you try and spawnBox<dyn Future>
. It can be used in place ofBoxFuture
although it carries more overhead thanBoxFuture
, so it shouldn’t be used if it isn’t going to be spawned on a scope.SpawnableFuture
implementsFuture
but the future will not be running as a separate task if used this way. If polled and then later spawned, the spawned task will be polled again and any waker recorded when polled prior to spawning will be impotent.- 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.