Skip to main content

replace_manifest_version

Function replace_manifest_version 

Source
pub fn replace_manifest_version(
    path: &[u8],
    text: &str,
    from: &str,
    to: &str,
) -> Result<String, PolicyIncomplete>
Expand description

What: Replace the value of the first top-level "version" key, which must be exactly from quoted, with to quoted. &str borrows text; the result is owned. Why: Only the version changes; a manifest whose first top-level version holds something else (an escaped spelling, a different value, a duplicate key whose first value differs) is refused rather than guessed at.

In TS you’d write (pseudocode):

function replaceManifestVersion({ path, text, from, to }): string;