Skip to content

Commit

Permalink
[simple-api] Rename experimental feature to simple-api
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcono1234 committed Jul 31, 2024
1 parent e3cc722 commit d9a7331
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 15 deletions.
6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@ assert_no_alloc = { git = "https://github.com/Windfisch/rust-assert-no-alloc.git
[features]
# Optional Serde integration
serde = ["dep:serde"]
# Feature for all experimental functionality of Struson which is likely going to change in the future,
# or might even be removed again
# Note: Might be better to use standard Rust attributes for this once they are available, see https://github.com/rust-lang/rfcs/issues/1491
experimental = []
# Optional simple JSON reader and writer API
simple-api = []

[lints.rust]
unsafe_code = "forbid"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ Two variants of the API are provided:

**🔬 Experimental**\
The simple API and its naming is currently experimental, please provide feedback [here](https://github.com/Marcono1234/struson/issues/34).
It has to be enabled by specifying the `experimental` feature in `Cargo.toml`:
It has to be enabled by specifying the `simple-api` feature in `Cargo.toml`:

```toml
[dependencies]
struson = { version = "...", features = ["experimental"] }
struson = { version = "...", features = ["simple-api"] }
```

Any feedback is appreciated!
Expand Down
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@
//!
//! **🔬 Experimental**\
//! The simple API and its naming is currently experimental, please provide feedback [here](https://github.com/Marcono1234/struson/issues/34).
//! It has to be enabled by specifying the `experimental` feature in `Cargo.toml`:
//! It has to be enabled by specifying the `simple-api` feature in `Cargo.toml`:
//! ```toml
//! [dependencies]
//! struson = { version = "...", features = ["experimental"] }
//! struson = { version = "...", features = ["simple-api"] }
//! ```
//! Any feedback is appreciated!
//!
//! ### Reading
//! See [`SimpleJsonReader`](crate::reader::simple::SimpleJsonReader).
//!
//! ```
//! # #[cfg(feature = "experimental")]
//! # #[cfg(feature = "simple-api")]
//! # {
//! use struson::reader::simple::*;
//!
Expand All @@ -77,7 +77,7 @@
//! For reading nested values, the methods [`read_seeked`](crate::reader::simple::ValueReader::read_seeked)
//! and [`read_seeked_multi`](crate::reader::simple::ValueReader::read_seeked_multi) can be used:
//! ```
//! # #[cfg(feature = "experimental")]
//! # #[cfg(feature = "simple-api")]
//! # {
//! use struson::reader::simple::*;
//! use struson::reader::simple::multi_json_path::multi_json_path;
Expand Down Expand Up @@ -109,7 +109,7 @@
//! See [`SimpleJsonWriter`](crate::writer::simple::SimpleJsonWriter).
//!
//! ```
//! # #[cfg(feature = "experimental")]
//! # #[cfg(feature = "simple-api")]
//! # {
//! use struson::writer::simple::*;
//!
Expand Down
2 changes: 1 addition & 1 deletion src/reader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ use crate::writer::JsonWriter;
mod stream_reader;
// Re-export streaming implementation under `reader` module
pub use stream_reader::*;
#[cfg(feature = "experimental")]
#[cfg(feature = "simple-api")]
pub mod simple;

type IoError = std::io::Error;
Expand Down
2 changes: 1 addition & 1 deletion src/writer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::json_number::is_valid_json_number;
mod stream_writer;
// Re-export streaming implementation under `writer` module
pub use stream_writer::*;
#[cfg(feature = "experimental")]
#[cfg(feature = "simple-api")]
pub mod simple;

// TODO (custom JSON writer support): Remove this type alias? rust-analyzer otherwise uses that in generated
Expand Down
2 changes: 1 addition & 1 deletion tests/simple_reader.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Tests for [`struson::reader::simple`]
#![cfg(feature = "experimental")]
#![cfg(feature = "simple-api")]
#![cfg(feature = "serde")]

use std::{
Expand Down
2 changes: 1 addition & 1 deletion tests/simple_writer.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Tests for [`struson::writer::simple`]
#![cfg(feature = "experimental")]
#![cfg(feature = "simple-api")]
#![cfg(feature = "serde")]

use std::{
Expand Down

0 comments on commit d9a7331

Please sign in to comment.