Skip to main content

parse_semver_version

Function parse_semver_version 

Source
pub fn parse_semver_version(input: &str) -> Result<Version, VersionParseError>
Expand description

Parse a version that may omit the minor and/or patch components.

semver::Version requires all three components, but version reporters commonly provide only major.minor — rustc accepts 1.88, and simctl/IPHONEOS_DEPLOYMENT_TARGET use 26.0-style iOS versions. Missing trailing components are padded with zeros. A leading v and a -prerelease suffix are also accepted.

§Errors

  • If the input is empty, has more than three numeric components, or is not valid semver after normalization.