Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PartialVersion parsing support #325

Open
Benjscho opened this issue Oct 29, 2024 · 2 comments
Open

PartialVersion parsing support #325

Benjscho opened this issue Oct 29, 2024 · 2 comments

Comments

@Benjscho
Copy link

Benjscho commented Oct 29, 2024

Creating this issue to discuss about for PartialVersion parsing. Currently Version::parse only supports parsing full versions (i.e., with at least a major, minor, and a patch).

Would you be against adding support for PartialVersion parsing, e.g., in the same manner that Cargo handles partial versions? This would involve adding a new struct PartialVersion, that supports parsing incomplete versions, and implementing impl From<semver::PartialVersion> for Version

I'd be happy to submit a PR to add the struct & parsing if there's interest.

@dtolnay
Copy link
Owner

dtolnay commented Oct 29, 2024

I am open to it, but I have seen different projects expect different semantics from a "partial version". I would need to be shown that the behavior you want in this crate is widely applicable. For example I am not sure there is consensus about whether a partial version is supposed to represent build metadata.

@Benjscho
Copy link
Author

I'd propose following the implementation in Cargo, where if a PartialVersion can be completely parsed as a Version then it can contain build metadata, e.g., 0.1.0+build parses into a PartialVersion which contains build metadata, but 0.1+build would fail with a build metadata error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants