Skip to main content

poll

Function poll 

Source
pub async fn poll<T, S, F>(
    cfg: PollConfig,
    state: S,
    probe: F,
) -> Result<T, CoreError>
where F: for<'a> FnMut(&'a mut S) -> Probe<'a, T>,
Expand description

Poll probe until Done, the deadline expires, or an unretryable error fires (see module docs for the retry matrix). The FIRST probe runs immediately — no initial sleep.

state is the probe’s own mutable scratch (owned by the loop, lent fresh to every call) — the pattern that lets a borrowing async closure (FnMut(&'a mut S) -> Probe<'a, T>) carry a cursor or sink across iterations without naming an unnameable future type. wait-style callers pass ().