Macro chain

Source
macro_rules! chain {
    ($init:expr, $( $call:ident!($($arg:tt),+), )+) => { ... };
}
Expand description

Chains multiple macro calls together.

_ is used as a placeholder for the value that is being passed through the chained calls.

ยงExamples

use const_str::{chain, concat, replace, split};

const TOP: &str = "std";

const PARTS: &[&str] = &chain! {
   stringify!(std::sync::atomic::Ordering::Relaxed),
   replace!(_, { concat!(TOP, "::") }, ""),
   split!(_, "::"),
};

assert_eq!(PARTS, &["sync", "atomic", "Ordering", "Relaxed"]);