pub fn set_workspace_version(
manifest: &str,
from: &str,
to: &str,
) -> Result<String, BumpEditError>Expand description
Rewrite the [workspace.package] version = "<from>" line to to, returning the
new manifest text.
Scoped to the [workspace.package] section (the single source of truth for the
release version) so a version key in any other table — [package],
[dependencies.foo], [workspace.dependencies] — is never touched. Preserves the
line’s exact indentation and quote style; only the value between the quotes changes.
Verified against from (llm-review defense-in-depth): the line is rewritten only
when its current value is exactly from (the sealed pre-bump version). This makes the
edit fail closed on a tree that does not match the plan, and — since the whole-key scan
is line-oriented — it also sidesteps a version = "…" occurrence inside a quoted
string value (e.g. a description that mentions a version) unless that string
happens to equal from, in which case a following real version line still matches.
§Errors
BumpEditError::WorkspaceVersionNotFound when the section, or a version = "<from>"
line within it, is absent (fail closed rather than write a manifest with no bump).