Crate cfg_block

source ·
Expand description

A simple library for applying procedural macros to a block. Simple example:

use cfg_block::cfg_block;

cfg_block! {
    if #[cfg(mips)] {
        const STR_A: &str = "where did you get this processor";
        const STR_B: &str = "mips just makes a good passing doctest";
    } else {
        const STR_A: &str = "good!";
        const STR_B: &str = "better!";
    }
}

assert_eq!(STR_A, "good!");
assert_eq!(STR_B, "better!");

Most of the documentation is contained at cfg_block, please see there for more details.

Macros§

  • Allow applying inner procedural macros to a {} block, which helps a lot with platform-based const values.