7 releases (breaking)

0.6.0 Jan 22, 2025
0.5.0 Jan 22, 2025
0.4.0 Jan 22, 2025
0.3.1 Dec 17, 2024
0.1.0 Aug 21, 2024

#529 in Images

Download history 215/week @ 2024-10-24 260/week @ 2024-10-31 104/week @ 2024-11-07 219/week @ 2024-11-14 248/week @ 2024-11-21 281/week @ 2024-11-28 242/week @ 2024-12-05 683/week @ 2024-12-12 423/week @ 2024-12-19 256/week @ 2024-12-26 538/week @ 2025-01-02 376/week @ 2025-01-09 672/week @ 2025-01-16 533/week @ 2025-01-23 13/week @ 2025-01-30 20/week @ 2025-02-06

1,241 downloads per month

Custom license

10KB
148 lines

cfg-exif

GitHub Action Crate License

The rustfmt-friendly conditional compilation like cfg-if.

Features

  • Conditional compilation at both expression and item positions
  • rustfmt friendly

Examples

use cfg_exif::{expr, item};

item::cfg!(if (feature == "foo") {
    type Foo = usize;
} else if (target_pointer_width != "64") {
    type Foo = isize;
} else if ((target_family == "unix") && (feature == "bar")) {
    type Foo = i32;
} else if ((feature == "baz") || (target_os == "freebsd")) {
    type Foo = i64;
} else if (!(panic == "unwind")) {
    type Foo = i128;
} else {
    type Foo = f64;
});

assert_eq!(3.14 as Foo, 3.14);

assert_eq!(
    expr::cfg!(if (feature == "foo") {
        0
    } else if (target_pointer_width != "64") {
        1
    } else if ((target_family == "unix") && (feature == "bar")) {
        2
    } else if ((feature == "baz") || (target_os == "freebsd")) {
        3
    } else if (!(panic == "unwind")) {
        4
    } else {
        42
    }),
    42
);

License

The Unlicense

No runtime deps

Features