-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Support leading-zero logic #15
Comments
Interesting, never heard about Though I'd like to support this, I don't currently think the library allows adding support for this in it's current state (without drastic modifications). I've already wanted to do a full rewrite of So, I'm afraid I can't implement support for this right now. Sorry for that. Thank you for suggesting this. |
That makes sense. It might make sense to have support for multiple version string interpretations. Off-hand I can think of:
Given a schema, a string can be parsed using that and compared with those using a "compatible" versioning scheme. This could come with "satisfies" queries using the |
Exactly. Thank you for mentioning these other version schemes as well. I'm wondering what a good (portable and extendable) abstraction would be for this, that would be (almost) as easy to use as the current API specification. Something that would support any versioning format, for which parts are comparable as defined by some function, would be preferred to allow setting up your own scheme, even at runtime. The current implementation has something called a 'Version Manifest' which is intended for configuring version formats, but that isn't really used right now (nor does it provide the desired functionality as described above). Query operators are something I want to support as well, yes. I'm assuming different schemes can have different operators. So, a similar configurable abstraction would be required for this as well. I'll have to build some sort of truth-table having some arbitrary version formats some time. That would be a good start for thinking about a proper design as well. But I did not have the time yet to work on rebuilding this crate. |
Just whinging it here: trait VersionScheme: FromStr {
fn cmp(&self, rhs: &Self) -> Ordering;
}
impl<T: VersionScheme> PartialEq for T {
// use `VersionScheme::cmp`
}
impl<T: VersionScheme> Eq for T {
}
impl<T: VersionScheme> PartialOrd for T {
// use `VersionScheme::cmp`
}
impl<T: VersionScheme> Ord for T {
// use `VersionScheme::cmp`
}
trait SatisifiableVersion: VersionScheme {
type Query;
fn satisfies(&self, q: &Query) -> bool;
} Schemes can also implement |
The GNU extension function
strverscmp
supports counting leading zeroes. This would be nice to support here as well. http://man7.org/linux/man-pages/man3/strverscmp.3.html000 < 001 < 002 < 0010 < 01 < 0
The text was updated successfully, but these errors were encountered: