devela::code::util

Macro items

Source
macro_rules! items {
    ( $($item:item)* ) => { ... };
}
Expand description

Groups items together and expands them as if they were written directly.

It can be useful to apply an attribute to a group of items.

It can also preserve the formatting of the code provided as arguments, but the sf macro is better for that, since it works with any arbitrary code sequences like statements, expressions… instead of with just Rust items.

§Examples

#[cfg(feature = "std")]
items! {
    mod something {
        pub struct SomeThing;
    }
    pub use something::SomeThing;
}