summaryrefslogtreecommitdiffstats
path: root/vendor/yansi/src/macros.rs
blob: b7c0b0339865d2254fe8574c924a7b66a6244253 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
macro_rules! style_builder_for {
    ($T:ty, |$s:ident| $props:expr, $($name:ident: $property:ident),*) => ($(
        #[doc = concat!(
            "Enables the _", stringify!($name), "_ style on `self`.\n",
            "```rust\n",
            "use yansi::Paint;\n",
            "\n",
            "println!(\"Using ", stringify!($name), ": {}\", ",
                "Paint::new(\"hi\").", stringify!($name), "());\n",
            "```\n"
        )]
        #[inline]
        pub fn $name(self) -> $T {
            let mut $s = self;
            $props.set(Property::$property);
            $s
        }
    )*)
}