Crates.io | rustc-semver |
lib.rs | rustc-semver |
version | 1.1.0 |
source | src |
created_at | 2020-11-26 19:10:24.861105 |
updated_at | 2020-11-29 19:52:30.661686 |
description | Crate for parsing versions of Rust releases |
homepage | |
repository | https://github.com/flip1995/rustc-semver |
max_upload_size | |
id | 316832 |
size | 47,797 |
This crate provides a minimalistic parser for Rust versions.
The parser will only accept Versions in the form
<major>.<minor>.<patch>
and 3 special versions:
1.0.0-alpha
1.0.0-alpha.2
1.0.0-beta
This covers every version of rustc
that were released to date.
There are 2 functions to create a RustcVersion
:
const RustcVersion::new(u32, u32, u32)
: This is mainly used to create
constantsRustcVersion::parse(&str)
: Usually you want to parse a version with this
functionIf you have a RustcVersion
you can compare them, like you would expect:
assert!(RustcVersion::parse("1.42.0")? < RustcVersion::parse("1.43")?);
If you want to check whether one version meets another version according to the
Caret Requirements, there is the method RustcVersion::meets
:
assert!(RustcVersion::new(1, 48, 0).meets(RustcVersion::parse("1.42")?));
This repository adopts the Contributor Covenant Code of Conduct
Copyright 2020 Philipp Krones
Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option. Files in the project may not be copied, modified, or distributed except according to those terms.