Crates.io | runtime_cfg |
lib.rs | runtime_cfg |
version | 0.1.0 |
source | src |
created_at | 2019-05-29 11:24:08.935752 |
updated_at | 2019-05-29 11:24:08.935752 |
description | Evaluation of configuration flags, at runtime-time. |
homepage | https://github.com/flier/rust-runtime-cfg |
repository | |
max_upload_size | |
id | 137684 |
size | 34,305 |
runtime_cfg
Evaluation of configuration flags, at runtime-time.
To use runtime_cfg
in your project, add the following to your Cargo.toml:
[dependencies]
runtime-cfg = "0.1"
use std::convert::TryFrom;
use quote::quote;
use runtime_cfg::*;
let cfg = quote! { #[cfg(all(unix, target_pointer_width = "32"))] };
let cfg = Cfg::try_from(cfg).unwrap();
assert_eq!(cfg, all(vec![name("unix"), name_value("target_pointer_width", "32")]).into());
let flags = vec![("unix", None), ("target_pointer_width", Some("32"))];
assert!(cfg.matches(&flags));