Skip to main content

read_version

Function read_version 

Source
pub fn read_version(project_root: &Path) -> Result<Version, VersionError>
Expand description

Read the full Version (major/minor/patch) out of whatever version file detect_version_file resolves, mirroring write_version’s format handling (including [workspace.package]).

Unlike compute_version, this never touches git — it reports exactly what was last written to the version file, not a freshly recomputed minor/patch. Callers that need the version a prior write_version call actually wrote (e.g. after a tag was just cut) must use this instead of compute_version, which would see the new tag and return a different, larger version.