Skip to main content

verify_cache_with_progress

Function verify_cache_with_progress 

Source
pub async fn verify_cache_with_progress<F>(
    repo_id: &str,
    token: Option<&str>,
    revision: Option<&str>,
    on_event: F,
) -> Result<Vec<FileVerification>, FetchError>
where F: Fn(VerifyEvent<'_>),
Expand description

Same as verify_cache but emits VerifyEvents through on_event so callers can render streaming progress (e.g. a spinner per file).

The callback runs on the same task as the verification — keep it short. Use interior mutability (std::cell::Cell, std::cell::RefCell) if you need to track state across events; the closure may capture by shared reference because the API requires only Fn.

Files are processed in alphabetical order by filename so that streamed output remains stable across runs and matches the sort order of the returned Vec<FileVerification>.

§Errors

Same error conditions as verify_cache.