pub async fn scope_input_request_data<F: Future>(
batch: Option<BoundedInputRequestBatch>,
future: F,
) -> (F::Output, Option<BoundedInputRequestBatch>)Expand description
Lend one existing, uniquely owned input-data batch during a future’s polls.
The optional batch is moved, never cloned or persisted. A synchronous reader
can borrow it only in this scope. Normal completion, including an error
result, returns the original owner. Dropping or unwinding the future drops
that owner and restores the surrounding scope; it cannot resume the cancelled
work. None shadows an outer value. Detached tasks do not inherit the scope;
explicitly moving the whole scoped future carries only its own value.
This is unwired data transport, not an admission seal, caller identity, Source
lease or Skill permission. The host must apply InputObservation::update_current
between rounds and independently validate current authority before each use.
No Send bound is imposed on inline futures.
use bamboo_engine::runtime::managers::lifecycle::{
project_input_request_batch, scope_input_request_data,
with_scoped_input_request_data, InputRequestProjection,
};
let InputRequestProjection::Available(batch) = project_input_request_batch("s", "e", &[]) else { panic!() };
let (count, returned) = scope_input_request_data(Some(batch), async {
with_scoped_input_request_data("s", "e", |batch| batch.records().len())
}).await;
assert_eq!(count, Some(0));
assert!(returned.is_some());