• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

src/H03-May-2022-172130

.cargo-checksum.jsonH A D03-May-202289 11

.cargo_vcs_info.jsonH A D01-Jan-197074 65

.travis.ymlH A D02-Apr-2019370 2119

Cargo.tomlH A D01-Jan-19701.1 KiB3027

Cargo.toml.orig-cargoH A D02-Apr-2019623 2220

LICENSE-APACHEH A D02-Apr-201910.6 KiB202169

LICENSE-MITH A D02-Apr-20191 KiB2622

README.mdH A D02-Apr-20191.7 KiB6346

README.md

1# match_cfg
2
3[![Build Status](https://travis-ci.com/gnzlbg/match_cfg.svg?branch=master)](https://travis-ci.com/gnzlbg/match_cfg)
4
5[Documentation](https://docs.rs/match_cfg)
6
7**Minimum Supported Rust Version**: 1.13.0.
8
9A convenience macro to ergonomically define an item depending on a large number
10of `#[cfg]` parameters. Structured like match statement, the first matching
11branch is the item that gets emitted.
12
13```toml
14[dependencies]
15match_cfg = "0.1"
16```
17
18The `use_core` feature is enabled by default and builds the crate with `libcore`
19as a dependency by using the `#![no_std]` attribute. When this feature is
20disabled, this crate is built without libcore support by using the `#![no_core]`
21attribute - this makes use of the `#![feature(no_core)]` and requires a nightly
22version of Rust.
23
24## Example
25
26```rust
27#[macro_use(match_cfg)]
28extern crate match_cfg;
29
30match_cfg! {
31    #[cfg(unix)] => {
32         fn foo() { /* unix specific functionality */ }
33     }
34     #[cfg(target_pointer_width = "32")] => {
35         fn foo() { /* non-unix, 32-bit functionality */ }
36     }
37     _ => {
38         fn foo() { /* fallback implementation */ }
39     }
40}
41
42fn main() {
43    foo();
44}
45```
46
47# License
48
49This project is licensed under either of
50
51 * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
52   http://www.apache.org/licenses/LICENSE-2.0)
53 * MIT license ([LICENSE-MIT](LICENSE-MIT) or
54   http://opensource.org/licenses/MIT)
55
56at your option.
57
58### Contribution
59
60Unless you explicitly state otherwise, any contribution intentionally submitted
61for inclusion in Serde by you, as defined in the Apache-2.0 license, shall be
62dual licensed as above, without any additional terms or conditions.
63