Skip to content

Commit 308c590

Browse files
authored
docs: prepare instability-example for publish (#18)
- reword README - set msrv to 1.64 - fix feature flags in example - fix licenses (remove NOTICES, use The Ratatui Developers) - remove CODEOWNERS file
1 parent 7655288 commit 308c590

File tree

9 files changed

+118
-71
lines changed

9 files changed

+118
-71
lines changed

.github/workflows/check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ jobs:
6767
RUSTDOCFLAGS: --cfg docsrs
6868
msrv:
6969
# check that we can build using the minimal rust version that is specified by this crate
70-
name: Check MSRV (1.63)
70+
name: Check MSRV (1.64)
7171
runs-on: ubuntu-latest
7272
steps:
7373
- uses: actions/checkout@v4
74-
- uses: dtolnay/rust-toolchain@1.63
74+
- uses: dtolnay/rust-toolchain@1.64
7575
- run: cargo check

CODEOWNERS

Lines changed: 0 additions & 1 deletion
This file was deleted.

Cargo.toml

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
1+
[workspace]
2+
resolver = "2"
3+
members = ["example"]
4+
5+
[workspace.package]
6+
authors = ["Stephen M. Coakley <[email protected]>", "The Ratatui Developers"]
7+
license = "MIT"
8+
version = "0.3.4"
9+
edition = "2021"
10+
rust-version = "1.64"
11+
repository = "https://github.com/ratatui-org/instability"
12+
13+
[workspace.dependencies]
14+
instability = { path = ".", version = "0.3.4" }
15+
116
[package]
217
name = "instability"
3-
version = "0.3.4"
418
description = "Rust API stability attributes for the rest of us. A fork of the `stability` crate."
5-
authors = ["Stephen M. Coakley <[email protected]>", "Joshka"]
6-
license = "MIT"
7-
repository = "https://github.com/ratatui-org/instability"
819
documentation = "https://docs.rs/instability/"
20+
authors.workspace = true
21+
license.workspace = true
22+
version.workspace = true
23+
edition.workspace = true
24+
rust-version.workspace = true
25+
repository.workspace = true
926
readme = "README.md"
10-
edition = "2021"
11-
rust-version = "1.63"
1227

1328
[dependencies]
1429
darling = "0.20.10"
1530
indoc = "2.0.5"
1631
pretty_assertions = "1.4.1"
17-
proc-macro2 = "1.0.89"
18-
quote = "1.0.26"
19-
syn = { version = "2.0.15", features = ["derive", "full"] }
32+
proc-macro2 = "1.0.92"
33+
quote = "1.0.37"
34+
syn = { version = "2.0.90", features = ["derive", "full"] }
2035

2136
[lib]
2237
proc-macro = true
23-
24-
[workspace]
25-
members = ["example"]

LICENSE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# MIT License
22

33
Copyright (c) 2020 Stephen M. Coakley
4+
Copyright (c) The Ratatui Developers
45

56
Permission is hereby granted, free of charge, to any person obtaining a copy
67
of this software and associated documentation files (the "Software"), to deal

NOTICES.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

README.md

Lines changed: 43 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,64 @@
22

33
Rust API stability attributes for the rest of us.
44

5-
[![Crates.io](https://img.shields.io/crates/v/instability.svg)](https://crates.io/crates/instability)
6-
[![Documentation](https://docs.rs/instability/badge.svg)][documentation]
7-
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md)
8-
![Minimum supported Rust version](https://img.shields.io/badge/rustc-1.63+-yellow.svg)
9-
[![Build](https://github.com/ratatui-org/instability/workflows/Check/badge.svg)](https://github.com/ratatui-org/instability/actions)
10-
[![Build](https://github.com/ratatui-org/instability/workflows/Test/badge.svg)](https://github.com/ratatui-org/instability/actions)
5+
[![Crate Badge]][Crate] [![Build Badge]][Build] [![Docs Badge]][Docs] [![License Badge]][License]
6+
![MSRV Badge]
117

128
## Overview
139

14-
This is a fork of the [Stability](https://crates.io/crates/stability) crate with the
15-
[blessing](https://github.com/sagebind/stability/issues/12) of the original maintainer Stephen M.
16-
Coakley ([@sagebind](https://github.com/sagebind)). This crate provides attribute macros for
17-
specifying API stability of public API items of a crate. For a quick example:
10+
This crate provides attribute macros for specifying API stability of public API items of a crate. It
11+
is a [fork] of the [Stability] original created by Stephen M. Coakley ([@sagebind]).
12+
13+
## Usage
14+
15+
Add the `instability` crate to your `Cargo.toml` file:
16+
17+
```shell
18+
cargo add instability
19+
```
20+
21+
Then, use the `#[instability::stable]` and `#[instability::unstable]` attributes to specify the
22+
stability of your API items:
1823

1924
```rust
2025
/// This function does something really risky!
21-
///
22-
/// Don't use it yet!
2326
#[instability::unstable(feature = "risky-function")]
2427
pub fn risky_function() {
25-
unimplemented!()
28+
println!("This function is unstable!");
2629
}
27-
```
28-
29-
Please check out the [documentation] for detailed usage.
3030

31-
## Installation
31+
/// This function is safe to use!
32+
#[instability::stable(since = "1.0.0")]
33+
pub fn stable_function() {
34+
println!("This function is stable!");
35+
}
36+
```
3237

33-
Install via Cargo by adding to your `Cargo.toml` file:
38+
A feature flag prefixed with "unstable-" will be created that can be used to enable unstable items.
39+
The macro will append an extra documentation comment that describes the stability of the item. The
40+
visibility of the item will be changed to `pub(crate)` when the feature is not enabled (or when the
41+
attribute is on an impl block, the entire block will be removed).
3442

35-
```toml
36-
[dependencies]
37-
instability = "0.3"
38-
```
43+
Check out the [Docs] for detailed usage. See [instability-example] for a complete example.
3944

40-
### Supported Rust versions
45+
## MSRV
4146

42-
The current release is only guaranteed to work with the latest stable Rust compiler.
47+
The minimum supported Rust version (MSRV) is 1.64.0.
4348

4449
## License
4550

46-
This project's source code and documentation are licensed under the MIT license. See the [LICENSE](LICENSE.md) file for details.
51+
This project's source code and documentation are licensed under the MIT [License].
4752

48-
[documentation]: https://docs.rs/instability
53+
[Crate Badge]: https://img.shields.io/crates/v/instability
54+
[Build Badge]: https://img.shields.io/github/actions/workflow/status/ratatui/instability/check.yml
55+
[Docs Badge]: https://img.shields.io/docsrs/instability
56+
[License Badge]: https://img.shields.io/crates/l/instability
57+
[MSRV Badge]: https://img.shields.io/crates/msrv/instability
58+
[Crate]: https://crates.io/crates/instability
59+
[Build]: https://github.com/ratatui/instability/actions/workflows/check.yml
60+
[Docs]: https://docs.rs/instability
61+
[License]: ./LICENSE.md
62+
[stability]: https://crates.io/crates/stability
63+
[@Sagebind]: https://github.com/sagebind
64+
[fork]: https://github.com/sagebind/stability/issues/12
65+
[instability-example]: https://crates.io/crates/instability-example

example/Cargo.toml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,31 @@
11
[package]
22
name = "instability-example"
3-
version = "0.0.0"
43
description = "Example crate demonstrating instablity usage."
5-
authors = ["Stephen M. Coakley <[email protected]>", "Joshka"]
6-
edition = "2021"
7-
publish = false
4+
documentation = "https://docs.rs/instability-example/"
5+
authors.workspace = true
6+
license.workspace = true
7+
version.workspace = true
8+
edition.workspace = true
9+
rust-version.workspace = true
10+
repository.workspace = true
811

912
[features]
10-
unstable-risky-function = []
11-
unstable-risky-struct = []
13+
default = []
14+
unstable-enum = []
15+
unstable-constant = []
16+
unstable-function = []
17+
unstable-method = []
18+
unstable-module = []
19+
unstable-private-function = []
20+
unstable-reexport = []
21+
unstable-static = []
22+
unstable-struct-with-issue = []
23+
unstable-struct = []
24+
unstable-trait = []
25+
unstable-type-alias = []
1226

1327
[dependencies]
14-
instability = { path = "../" }
28+
instability.workspace = true
1529

1630
[package.metadata.docs.rs]
1731
all-features = true

example/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Instability-example
2+
3+
This crate is an example of using the stability attributes from the [instability crate].
4+
5+
[![Crate Badge]][Crate] [![Build Badge]][Build] [![Docs Badge]][Docs] [![License Badge]][License]
6+
![MSRV Badge]
7+
8+
## Overview
9+
10+
- Example code: [lib.rs](./src/lib.rs).
11+
- Output: See the [Docs.rs][Docs] page for the output of the example code.
12+
13+
## License
14+
15+
This project's source code and documentation are licensed under the MIT [License].
16+
17+
[instability crate]: https://crates.io/crates/instability
18+
[Crate Badge]: https://img.shields.io/crates/v/instability-example
19+
[Build Badge]: https://img.shields.io/github/actions/workflow/status/ratatui/instability/check.yml
20+
[Docs Badge]: https://img.shields.io/docsrs/instability-example
21+
[License Badge]: https://img.shields.io/crates/l/instability-example
22+
[MSRV Badge]: https://img.shields.io/crates/msrv/instability-example
23+
[Crate]: https://crates.io/crates/instability-example
24+
[Build]: https://github.com/ratatui/instability/actions/workflows/check.yml
25+
[Docs]: https://docs.rs/instability-example
26+
[License]: ../LICENSE.md

example/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#![cfg_attr(docsrs, feature(doc_cfg))]
22
#![allow(dead_code)]
33

4-
//! This is an example library demonstrating various attributes from the
5-
//! stability crate.
4+
//! This is an example library demonstrating various attributes from the [`instability`] crate.
65
76
/// A stable type alias
87
///

0 commit comments

Comments
 (0)