mirror of
https://gitee.com/openharmony/third_party_rust_version_check
synced 2024-11-23 07:49:54 +00:00
Add supports_features function.
This commit is contained in:
parent
a4f89eb7c6
commit
7f6df72efa
13
src/lib.rs
13
src/lib.rs
@ -170,3 +170,16 @@ pub fn is_dev() -> Option<bool> {
|
||||
get_version_and_date()
|
||||
.map(|(actual_version_str, _)| actual_version_str.contains("dev"))
|
||||
}
|
||||
|
||||
/// Determines whether the running or installed `rustc` supports feature flags.
|
||||
/// In other words, if the channel is either "nightly" or "dev".
|
||||
///
|
||||
/// If the version could not be determined, returns `None`. Otherwise returns
|
||||
/// `Some(true)` if the running version supports features, and `Some(false)`
|
||||
/// otherwise.
|
||||
pub fn supports_features() -> Option<bool> {
|
||||
match is_nightly() {
|
||||
b@Some(true) => b,
|
||||
_ => is_dev()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user