Available on crate feature
async only.Expand description
Executor-agnostic async instrumentation helpers for OSActivity.
Enable this module with the async Cargo feature:
[dependencies]
apple-log = { version = "0.6", features = ["async"] }ActivityFuture wraps any Future and enters an OSActivity around each
poll. This keeps activity scoping aligned with executor wakeups without
holding a scope guard across suspension points.
§Example
use apple_log::{OSActivity, OSActivityFlags};
let bytes = OSActivity::new(
"download asset",
Some(&OSActivity::current()),
OSActivityFlags::DEFAULT,
)?
.instrument_future(async { 42_usize })
.await?;
assert_eq!(bytes, 42);Structs§
- Activity
Future - Future wrapper that re-enters an
OSActivityevery time the executor polls it.
Functions§
- instrument_
future - Wrap
futureso each poll executes insideactivity.