Skip to main content

SliceFn

Type Alias SliceFn 

Source
pub type SliceFn = Box<dyn FnMut(Duration) -> SliceOutcome + Send + 'static>;
Available on non-target_family=wasm only.
Expand description

Boxed closure each per-backend wait_async override builds at handoff time. The waiter thread calls it on its own thread with the current slice budget; the closure must:

  • Issue the native blocking-with-timeout primitive (vkWaitSemaphores, WaitForSingleObject, MTLSharedEvent::waitUntilSignaledValue:timeoutMS:, clWaitForEvents, device.poll(Wait { … }), …) with the slice budget.

  • Return one of the three SliceOutcome variants.

Send is required because the closure runs on the waiter thread, not on the executor’s poll thread. 'static because the slice closure is consumed asynchronously and outlives the await position that built it.

Aliased Type§

pub struct SliceFn(/* private fields */);