aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / vendor / rustc_version / README.md
| 1 | rustc-version-rs |
| 2 | ================ |
| 3 | |
| 4 | [](https://docs.rs/rustc_version/) |
| 5 | [](https://crates.io/crates/rustc_version) |
| 6 | [](https://github.com/djc/rustc-version-rs/actions?query=workflow%3ACI) |
| 7 | |
| 8 | A library for querying the version of a `rustc` compiler. |
| 9 | |
| 10 | This can be used by build scripts or other tools dealing with Rust sources |
| 11 | to make decisions based on the version of the compiler. Current MSRV is 1.32.0. |
| 12 | |
| 13 | If this is of interest, also consider looking at these other crates: |
| 14 | |
| 15 | * [autocfg](https://crates.io/crates/autocfg/), which helps with feature detection instead of depending on compiler versions |
| 16 | * [rustversion](https://github.com/dtolnay/rustversion) provides a procedural macro with no other dependencies |
| 17 | |
| 18 | # Getting Started |
| 19 | |
| 20 | [rustc-version-rs is available on crates.io](https://crates.io/crates/rustc_version). |
| 21 | It is recommended to look there for the newest released version, as well as links to the newest builds of the docs. |
| 22 | |
| 23 | At the point of the last update of this README, the latest published version could be used like this: |
| 24 | |
| 25 | Add the following dependency to your Cargo manifest... |
| 26 | |
| 27 | ```toml |
| 28 | [build-dependencies] |
| 29 | rustc_version = "0.2" |
| 30 | ``` |
| 31 | |
| 32 | ... and see the [docs](https://docs.rs/rustc_version) for how to use it. |
| 33 | |
| 34 | # Example |
| 35 | |
| 36 | ```rust |
| 37 | // This could be a cargo build script |
| 38 | |
| 39 | use rustc_version::{version, version_meta, Channel, Version}; |
| 40 | |
| 41 | fn main() { |
| 42 | // Assert we haven't travelled back in time |
| 43 | assert!(version().unwrap().major >= 1); |
| 44 | |
| 45 | // Set cfg flags depending on release channel |
| 46 | match version_meta().unwrap().channel { |
| 47 | Channel::Stable => { |
| 48 | println!("cargo:rustc-cfg=RUSTC_IS_STABLE"); |
| 49 | } |
| 50 | Channel::Beta => { |
| 51 | println!("cargo:rustc-cfg=RUSTC_IS_BETA"); |
| 52 | } |
| 53 | Channel::Nightly => { |
| 54 | println!("cargo:rustc-cfg=RUSTC_IS_NIGHTLY"); |
| 55 | } |
| 56 | Channel::Dev => { |
| 57 | println!("cargo:rustc-cfg=RUSTC_IS_DEV"); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | // Check for a minimum version |
| 62 | if version().unwrap() >= Version::parse("1.4.0").unwrap() { |
| 63 | println!("cargo:rustc-cfg=compiler_has_important_bugfix"); |
| 64 | } |
| 65 | } |
| 66 | ``` |
| 67 | |
| 68 | ## License |
| 69 | |
| 70 | Licensed under either of |
| 71 | |
| 72 | * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) |
| 73 | * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) |
| 74 | |
| 75 | at your option. |
| 76 | |
| 77 | ### Contribution |
| 78 | |
| 79 | Unless you explicitly state otherwise, any contribution intentionally submitted |
| 80 | for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any |
| 81 | additional terms or conditions. |