Skip to main content

check_once

Function check_once 

Source
pub fn check_once(
    cell: &OnceLock<Result<GitRelease, String>>,
    context: &GitContext,
    ask: fn(&GitContext) -> Result<GitRelease, String>,
) -> Result<GitRelease, String>
Expand description

What: Return the answer already stored in cell, or ask once and store the answer. Why: check_git_version keeps one answer per process; a separate cell lets the controls prove the ask runs once without sharing the process-wide answer.

In TS you’d write (pseudocode):

const checked ??= await askGitVersion(context);