1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//! Unstable I/O driver hosting utilities for the Arty runtime.
//!
//! This crate is implementation infrastructure for [`arty`](https://docs.rs/arty).
//! Applications and libraries should use `arty` instead of depending on this
//! crate directly.
//!
//! The items are public because Arty consumes them across a crate boundary.
//! They do not form a standalone stability or compatibility promise.
//!
//! # Quick start
//!
//! Clone the runtime-wide registry for each worker, relocate the clone onto
//! that worker, and then create its driver host:
//!
//! ```
//! # use std::task::Waker;
//! # use std::time::Duration;
//! # use arty_io_host::IoRuntime;
//! # use observed::Sink;
//! # use thread_aware::{ThreadAware, ThreadBuilder};
//! # fn main() -> Result<(), arty_io_core::DriverError> {
//! // One runtime-wide value owns the shared context registry and telemetry sink.
//! let runtime = IoRuntime::new(Sink::noop());
//! let worker = ThreadBuilder::default().build(std::thread::current().id());
//!
//! // Each worker receives a clone that must be relocated on the destination
//! // thread before its worker-local host is created.
//! let mut worker_runtime = runtime.clone();
//! worker_runtime.relocate(None, &worker);
//! let host = worker_runtime.driver_host(Waker::noop().clone());
//!
//! // The runtime calls this from its worker loop with the available wait time.
//! host.execute_cycle(Duration::ZERO)?;
//! # Ok(())
//! # }
//! ```
pub use DriverHost;
pub use IoRuntime;