Skip to main content

wait_for_unless

Function wait_for_unless 

Source
pub async fn wait_for_unless(
    home: &Path,
    cache_dir: &Path,
    owner: &Owner,
    budget: Duration,
    poll: Duration,
    cancel: &(dyn Fn() -> bool + Sync),
) -> Result<Option<Guard>>
Expand description

wait_for that also gives up, with Ok(None), as soon as cancel returns true. cancel is looked at once per poll, so a park request is honoured within a poll interval instead of after the whole budget. The lease is never held on that path: nothing was acquired.