Skip to main content

stability

Attribute Macro stability 

Source
#[stability]
Expand description

Marks an item with a stability level.

When building with RUSTFLAGS="--cfg commonware_stability_X", items with stability less than X are excluded. Unmarked items are always included.

See commonware README for stability level definitions.

§Example

use commonware_macros::stability;

#[stability(BETA)]  // excluded at GAMMA, DELTA, EPSILON
pub struct StableApi { }

§Limitation: #[macro_export] macros

Due to a Rust limitation (rust-lang/rust#52234), #[macro_export] macros cannot be placed inside stability_scope! or use #[stability]. Macro-expanded #[macro_export] macros cannot be referenced by absolute paths.

For #[macro_export] macros, use manual cfg attributes instead:

#[cfg(not(any(
    commonware_stability_GAMMA,
    commonware_stability_DELTA,
    commonware_stability_EPSILON,
    commonware_stability_RESERVED
)))] // BETA
#[macro_export]
macro_rules! my_macro { ... }