Skip to main content

stability_scope

Macro stability_scope 

Source
stability_scope!() { /* proc-macro */ }
Expand description

Marks all items within a scope with a stability level and optional cfg predicate.

When building with RUSTFLAGS="--cfg commonware_stability_N", items with stability less than N are excluded.

§Example

use commonware_macros::stability_scope;

// Without cfg predicate
stability_scope!(BETA {
    pub mod stable_module;
    pub use crate::stable_module::Item;
});

// With cfg predicate
stability_scope!(BETA, cfg(feature = "std") {
    pub mod std_only_module;
});

§Limitation: #[macro_export] macros

#[macro_export] macros cannot be placed inside stability_scope! due to a Rust limitation (rust-lang/rust#52234). Use manual cfg attributes instead. See stability for details.