#[graph]Expand description
Build the function’s await dependency graph and run independent work concurrently.
Options:
bound = Ncaps concurrent loop iterations (default 16);explainprints the graph at compile time;offcompiles the function as written (for comparisons;PSYNC_GRAPH=offdoes it for all);stricttreats awaited calls psync cannot classify as writes to an unknown resource;calls = read | write | write_independent | independentmarks the whole function: how unclassified awaited calls are taken (overridingstrict), and, for theindependentforms, that every statement’s effects commute with the others’;speculatelets writes run before earlier exits everywhere in the function;effects(read(a, ..), write(b, ..), ordered(c, ..))names more verbs for the effect analysis;yield_every = Nmakes every loop of async code yield to the executor everyNiterations (preemption points for cooperative executors);crate = pathnames the psync crate in generated code.
Hints inside the function: #[psync::seq], #[psync::fresh], #[psync::independent],
#[psync::speculate].
ⓘ
#[psync::graph(bound = 8)]
async fn sizes(store: &Store, keys: &[String]) -> Result<u64, Error> {
let mut total = 0;
for key in keys {
total += store.head(key).await?.size; // up to 8 HEADs in flight
}
Ok(total)
}