#stability #attributes #documentation #rest #fork #items #public-api

macro instability

Rust API stability attributes for the rest of us. A fork of the stability crate.

8 releases

new 0.3.7 Jan 10, 2025
0.3.6 Jan 4, 2025
0.3.5 Dec 21, 2024
0.3.3 Nov 12, 2024
0.3.2 Jun 27, 2024

#859 in Procedural macros

Download history 26335/week @ 2024-09-22 30767/week @ 2024-09-29 33697/week @ 2024-10-06 38539/week @ 2024-10-13 42594/week @ 2024-10-20 41223/week @ 2024-10-27 40428/week @ 2024-11-03 46036/week @ 2024-11-10 44971/week @ 2024-11-17 41969/week @ 2024-11-24 48001/week @ 2024-12-01 45325/week @ 2024-12-08 46453/week @ 2024-12-15 32213/week @ 2024-12-22 36283/week @ 2024-12-29 52612/week @ 2025-01-05

172,106 downloads per month
Used in 463 crates (2 directly)

MIT license

39KB
740 lines

Instability

Rust API stability attributes for the rest of us.

Crate Badge Build Badge Docs Badge License Badge MSRV Badge

Overview

This crate provides attribute macros for specifying API stability of public API items of a crate. It is a fork of the Stability original created by Stephen M. Coakley (@sagebind).

Usage

Add the instability crate to your Cargo.toml file:

cargo add instability

Then, use the #[instability::stable] and #[instability::unstable] attributes to specify the stability of your API items:

/// This function does something really risky!
#[instability::unstable(feature = "risky-function")]
pub fn risky_function() {
    println!("This function is unstable!");
}

/// This function is safe to use!
#[instability::stable(since = "1.0.0")]
pub fn stable_function() {
    println!("This function is stable!");
}

A feature flag prefixed with "unstable-" will be created that can be used to enable unstable items. The macro will append an extra documentation comment that describes the stability of the item. The visibility of the item will be changed to pub(crate) when the feature is not enabled (or when the attribute is on an impl block, the entire block will be removed).

Check out the Docs for detailed usage. See instability-example for a complete example.

MSRV

The minimum supported Rust version (MSRV) is 1.64.0.

License

This project's source code and documentation are licensed under the MIT License.

Dependencies

~0.5–1MB
~22K SLoC