Skip to main content

tick_until

Function tick_until 

Source
pub fn tick_until<T, E>(
    pic: &PocketIc,
    max_rounds: u32,
    advance: Duration,
    poll: impl FnMut(&PocketIc) -> Poll<Result<T, E>>,
) -> Result<T, TickUntilError<E>>
Expand description

Check a caller-owned predicate, advancing simulated time and ticking while pending.

The predicate runs once before any mutation. Each pending result permits one round of advance_time(advance), then tick(), then another predicate check, up to max_rounds. A zero budget still performs the initial check. A zero duration permits ticks without reading or writing simulated time. Completion on the last allowed round succeeds; predicate failures return immediately without another round.

This bounds simulated progression, not wall-clock time spent inside PocketIC calls or the predicate. PocketIC operation failures retain upstream panic behavior. Applications own readiness meaning and predicate error types.

ยงErrors

Returns the predicate error or ProgressLimit when all permitted rounds remain pending.