Skip to content

Commit 40cc2aa

Browse files
authored
Rename use-serde feature into serde (#146)
1 parent 5622313 commit 40cc2aa

File tree

9 files changed

+48
-55
lines changed

9 files changed

+48
-55
lines changed

Diff for: .github/PULL_REQUEST_TEMPLATE.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
### Checklist
66
- [ ] Formatted code using `cargo fmt --all`
77
- [ ] Linted code using clippy
8-
- [ ] with reqwest feature: `cargo clippy --manifest-path influxdb/Cargo.toml --all-targets --no-default-features --features use-serde,derive,reqwest-client-rustls -- -D warnings`
9-
- [ ] with surf feature: `cargo clippy --manifest-path influxdb/Cargo.toml --all-targets --no-default-features --features use-serde,derive,hyper-client -- -D warnings`
8+
- [ ] with reqwest feature: `cargo clippy --manifest-path influxdb/Cargo.toml --all-targets --no-default-features --features serde,derive,reqwest-client-rustls -- -D warnings`
9+
- [ ] with surf feature: `cargo clippy --manifest-path influxdb/Cargo.toml --all-targets --no-default-features --features serde,derive,hyper-client -- -D warnings`
1010
- [ ] Updated README.md using `cargo doc2readme -p influxdb --expand-macros`
1111
- [ ] Reviewed the diff. Did you leave any print statements or unnecessary comments?
1212
- [ ] Any unfinished work that warrants a separate issue captured in an issue with a TODO code comment

Diff for: .github/workflows/rust.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ jobs:
2828
with:
2929
components: clippy
3030
- name: Check Clippy lints (reqwest)
31-
run: cargo clippy --manifest-path influxdb/Cargo.toml --all-targets --no-default-features --features use-serde,derive,reqwest-client-rustls -- -D warnings
31+
run: cargo clippy --manifest-path influxdb/Cargo.toml --all-targets --no-default-features --features serde,derive,reqwest-client-rustls -- -D warnings
3232
- name: Check Clippy lints (surf)
33-
run: cargo clippy --manifest-path influxdb/Cargo.toml --all-targets --no-default-features --features use-serde,derive,hyper-client -- -D warnings
33+
run: cargo clippy --manifest-path influxdb/Cargo.toml --all-targets --no-default-features --features serde,derive,hyper-client -- -D warnings
3434

3535
# this checks that the code is formatted with rustfmt
3636
rustfmt:
@@ -145,7 +145,7 @@ jobs:
145145
run: |
146146
for test in integration_tests{,_v2}
147147
do
148-
cargo test -p influxdb --no-default-features --features 'use-serde derive ${{matrix.http-backend}}' --no-fail-fast --test $test
148+
cargo test -p influxdb --no-default-features --features 'serde derive ${{matrix.http-backend}}' --no-fail-fast --test $test
149149
done
150150
151151
# this uses cargo-tarpaulin to inspect the code coverage
@@ -192,7 +192,7 @@ jobs:
192192
cargo tarpaulin -v \
193193
--target-dir target/tarpaulin \
194194
--workspace \
195-
--features use-serde,derive \
195+
--features serde,derive \
196196
--exclude-files 'derive/*' \
197197
--exclude-files 'target/*' \
198198
--ignore-panics --ignore-tests \

Diff for: README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -119,43 +119,43 @@ To communicate with InfluxDB, you can choose the HTTP backend to be used configu
119119

120120
- **[hyper][__link7]** (through reqwest), with native TLS (OpenSSL)
121121
```toml
122-
influxdb = { version = "0.7.2", default-features = false, features = ["derive", "use-serde", "reqwest-client-native-tls"] }
122+
influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "reqwest-client-native-tls"] }
123123
```
124124

125125

126126
- **[hyper][__link8]** (through reqwest), with vendored native TLS (OpenSSL)
127127
```toml
128-
influxdb = { version = "0.7.2", default-features = false, features = ["derive", "use-serde", "reqwest-client-native-tls-vendored"] }
128+
influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "reqwest-client-native-tls-vendored"] }
129129
```
130130

131131

132132
- **[hyper][__link9]** (through surf), use this if you need tokio 0.2 compatibility
133133
```toml
134-
influxdb = { version = "0.7.2", default-features = false, features = ["derive", "use-serde", "hyper-client"] }
134+
influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "hyper-client"] }
135135
```
136136

137137

138138
- **[curl][__link10]**, using [libcurl][__link11]
139139
```toml
140-
influxdb = { version = "0.7.2", default-features = false, features = ["derive", "use-serde", "curl-client"] }
140+
influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "curl-client"] }
141141
```
142142

143143

144144
- **[async-h1][__link12]** with native TLS (OpenSSL)
145145
```toml
146-
influxdb = { version = "0.7.2", default-features = false, features = ["derive", "use-serde", "h1-client"] }
146+
influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "h1-client"] }
147147
```
148148

149149

150150
- **[async-h1][__link13]** with [rustls][__link14]
151151
```toml
152-
influxdb = { version = "0.7.2", default-features = false, features = ["derive", "use-serde", "h1-client-rustls"] }
152+
influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "h1-client-rustls"] }
153153
```
154154

155155

156156
- WebAssembly’s `window.fetch`, via `web-sys` and **[wasm-bindgen][__link15]**
157157
```toml
158-
influxdb = { version = "0.7.2", default-features = false, features = ["derive", "use-serde", "wasm-client"] }
158+
influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "wasm-client"] }
159159
```
160160

161161

@@ -170,7 +170,7 @@ To communicate with InfluxDB, you can choose the HTTP backend to be used configu
170170
@ 2020-2024 Gero Gerke, msrd0 and [contributors].
171171

172172
[contributors]: https://github.com/influxdb-rs/influxdb-rust/graphs/contributors
173-
[__cargo_doc2readme_dependencies_info]: ggGkYW0BYXSEG_RDmlyxxvyrG0rwcLBKoYdvG5It9hbWNgjUGzjD8iBYfsFFYXKEG1DulEn7euxHG8tYaxMHih9OG3Xjpd76jUgIG23kKLUzm3NrYWSBgmhpbmZsdXhkYmUwLjcuMg
173+
[__cargo_doc2readme_dependencies_info]: ggGkYW0BYXSEG_RDmlyxxvyrG0rwcLBKoYdvG5It9hbWNgjUGzjD8iBYfsFFYXKEG1LaAVLASZMqG5J2qfpyCvbMG_Rohh5BobOmG0DqLv5454SZYWSBgmhpbmZsdXhkYmUwLjcuMg
174174
[__link0]: https://github.com/influxdb-rs/influxdb-rust/blob/main/CONTRIBUTING.md
175175
[__link1]: https://github.com/influxdb-rs/influxdb-rust/blob/main/CODE_OF_CONDUCT.md
176176
[__link10]: https://github.com/alexcrichton/curl-rust

Diff for: influxdb/Cargo.toml

+5-4
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ lazy_static = "1.4.0"
2121
regex = "1.3.5"
2222
reqwest = { version = "0.11.4", default-features = false, optional = true }
2323
surf = { version = "2.2.0", default-features = false, optional = true }
24-
serde = { version = "1.0.104", features = ["derive"], optional = true }
24+
serde = { version = "1.0.186", optional = true }
25+
serde_derive = { version = "1.0.186", optional = true }
2526
serde_json = { version = "1.0.48", optional = true }
2627
thiserror = "1.0"
2728

2829
[features]
29-
default = ["use-serde", "reqwest-client-rustls"]
30-
derive = ["influxdb_derive"]
31-
use-serde = ["serde", "serde_json"]
30+
default = ["serde", "reqwest-client-rustls"]
31+
derive = ["dep:influxdb_derive"]
32+
serde = ["dep:serde", "dep:serde_derive", "dep:serde_json"]
3233

3334
# http clients
3435
curl-client = ["surf", "surf/curl-client"]

Diff for: influxdb/src/integrations/serde_integration/de.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
use super::{Series, TaggedSeries};
22
use serde::de::{
3-
value, DeserializeSeed, Deserializer, Error, IntoDeserializer, MapAccess, SeqAccess, Visitor,
3+
value, Deserialize, DeserializeSeed, Deserializer, Error, IntoDeserializer, MapAccess,
4+
SeqAccess, Visitor,
45
};
5-
use serde::Deserialize;
6+
use serde_derive::Deserialize;
67
use std::fmt;
78
use std::marker::PhantomData;
89

@@ -416,7 +417,7 @@ mod tests {
416417

417418
#[test]
418419
fn test_deserialize_borrowed() {
419-
use serde::Deserialize;
420+
use serde_derive::Deserialize;
420421

421422
// Deserializing a string that cannot be passed through
422423
// without escaping will result in an error like this:

Diff for: influxdb/src/integrations/serde_integration/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//!
99
//! ```rust,no_run
1010
//! use influxdb::{Client, Query};
11-
//! use serde::Deserialize;
11+
//! use serde_derive::Deserialize;
1212
//!
1313
//! #[derive(Deserialize)]
1414
//! struct WeatherWithoutCityName {
@@ -47,7 +47,8 @@
4747
4848
mod de;
4949

50-
use serde::{de::DeserializeOwned, Deserialize};
50+
use serde::de::DeserializeOwned;
51+
use serde_derive::Deserialize;
5152

5253
use crate::{client::check_status, Client, Error, Query, ReadQuery};
5354

Diff for: influxdb/src/lib.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,19 @@
7676
//! - **[hyper](https://github.com/hyperium/hyper)** (through reqwest, used by default), with [rustls](https://github.com/ctz/rustls)
7777
#![doc = cargo_toml!(indent="\t", "derive")]
7878
//! - **[hyper](https://github.com/hyperium/hyper)** (through reqwest), with native TLS (OpenSSL)
79-
#![doc = cargo_toml!(indent="\t", default-features = false, "derive", "use-serde", "reqwest-client-native-tls")]
79+
#![doc = cargo_toml!(indent="\t", default-features = false, "derive", "serde", "reqwest-client-native-tls")]
8080
//! - **[hyper](https://github.com/hyperium/hyper)** (through reqwest), with vendored native TLS (OpenSSL)
81-
#![doc = cargo_toml!(indent="\t", default-features = false, "derive", "use-serde", "reqwest-client-native-tls-vendored")]
81+
#![doc = cargo_toml!(indent="\t", default-features = false, "derive", "serde", "reqwest-client-native-tls-vendored")]
8282
//! - **[hyper](https://github.com/hyperium/hyper)** (through surf), use this if you need tokio 0.2 compatibility
83-
#![doc = cargo_toml!(indent="\t", default-features = false, "derive", "use-serde", "hyper-client")]
83+
#![doc = cargo_toml!(indent="\t", default-features = false, "derive", "serde", "hyper-client")]
8484
//! - **[curl](https://github.com/alexcrichton/curl-rust)**, using [libcurl](https://curl.se/libcurl/)
85-
#![doc = cargo_toml!(indent="\t", default-features = false, "derive", "use-serde", "curl-client")]
85+
#![doc = cargo_toml!(indent="\t", default-features = false, "derive", "serde", "curl-client")]
8686
//! - **[async-h1](https://github.com/http-rs/async-h1)** with native TLS (OpenSSL)
87-
#![doc = cargo_toml!(indent="\t", default-features = false, "derive", "use-serde", "h1-client")]
87+
#![doc = cargo_toml!(indent="\t", default-features = false, "derive", "serde", "h1-client")]
8888
//! - **[async-h1](https://github.com/http-rs/async-h1)** with [rustls](https://github.com/ctz/rustls)
89-
#![doc = cargo_toml!(indent="\t", default-features = false, "derive", "use-serde", "h1-client-rustls")]
89+
#![doc = cargo_toml!(indent="\t", default-features = false, "derive", "serde", "h1-client-rustls")]
9090
//! - WebAssembly's `window.fetch`, via `web-sys` and **[wasm-bindgen](https://github.com/rustwasm/wasm-bindgen)**
91-
#![doc = cargo_toml!(indent="\t", default-features = false, "derive", "use-serde", "wasm-client")]
91+
#![doc = cargo_toml!(indent="\t", default-features = false, "derive", "serde", "wasm-client")]
9292
//!
9393
//! # License
9494
//!
@@ -148,8 +148,8 @@ pub use query::{
148148
InfluxDbWriteable, Query, QueryType, Timestamp, ValidQuery,
149149
};
150150

151-
#[cfg(feature = "use-serde")]
151+
#[cfg(feature = "serde")]
152152
pub mod integrations {
153-
#[cfg(feature = "use-serde")]
153+
#[cfg(feature = "serde")]
154154
pub mod serde_integration;
155155
}

Diff for: influxdb/tests/derive_integration_tests.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use influxdb::InfluxDbWriteable;
77
use chrono::{DateTime, Utc};
88
use influxdb::{Query, ReadQuery, Timestamp};
99

10-
#[cfg(feature = "use-serde")]
11-
use serde::Deserialize;
10+
#[cfg(feature = "serde")]
11+
use serde_derive::Deserialize;
1212

1313
use utilities::{assert_result_ok, create_client, create_db, delete_db, run_test};
1414

@@ -24,7 +24,7 @@ struct WeatherReading {
2424
}
2525

2626
#[derive(Debug)]
27-
#[cfg_attr(feature = "use-serde", derive(Deserialize))]
27+
#[cfg_attr(feature = "serde", derive(Deserialize))]
2828
struct WeatherReadingWithoutIgnored {
2929
time: DateTime<Utc>,
3030
pressure: i32,
@@ -81,7 +81,7 @@ async fn test_derive_simple_write() {
8181
///
8282
/// This integration tests that writing data and retrieving the data again is working
8383
#[cfg(feature = "derive")]
84-
#[cfg(feature = "use-serde")]
84+
#[cfg(feature = "serde")]
8585
#[async_std::test]
8686
#[cfg(not(tarpaulin_include))]
8787
async fn test_write_and_read_option() {

Diff for: influxdb/tests/integration_tests.rs

+9-19
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ extern crate influxdb;
33
#[path = "./utilities.rs"]
44
mod utilities;
55

6-
use serde::Deserialize;
6+
use serde_derive::Deserialize;
77
use utilities::{
88
assert_result_err, assert_result_ok, create_client, create_db, delete_db, run_test,
99
};
@@ -277,7 +277,7 @@ async fn test_write_and_read_field() {
277277
///
278278
/// This test case tests the authentication on json reads
279279
#[async_std::test]
280-
#[cfg(feature = "use-serde")]
280+
#[cfg(feature = "serde")]
281281
#[cfg(not(tarpaulin_include))]
282282
async fn test_json_non_authed_read() {
283283
const TEST_NAME: &str = "test_json_non_authed_read";
@@ -322,7 +322,7 @@ async fn test_json_non_authed_read() {
322322
///
323323
/// This test case tests the authentication on json reads
324324
#[async_std::test]
325-
#[cfg(feature = "use-serde")]
325+
#[cfg(feature = "serde")]
326326
#[cfg(not(tarpaulin_include))]
327327
async fn test_json_authed_read() {
328328
const TEST_NAME: &str = "test_json_authed_read";
@@ -359,11 +359,9 @@ async fn test_json_authed_read() {
359359
///
360360
/// This integration tests that writing data and retrieving the data again is working
361361
#[async_std::test]
362-
#[cfg(feature = "use-serde")]
362+
#[cfg(feature = "serde")]
363363
#[cfg(not(tarpaulin_include))]
364364
async fn test_write_and_read_option() {
365-
use serde::Deserialize;
366-
367365
const TEST_NAME: &str = "test_write_and_read_option";
368366

369367
run_test(
@@ -420,11 +418,9 @@ async fn test_write_and_read_option() {
420418
/// This test case tests whether JSON can be decoded from a InfluxDB response and whether that JSON
421419
/// is equal to the data which was written to the database
422420
#[async_std::test]
423-
#[cfg(feature = "use-serde")]
421+
#[cfg(feature = "serde")]
424422
#[cfg(not(tarpaulin_include))]
425423
async fn test_json_query() {
426-
use serde::Deserialize;
427-
428424
const TEST_NAME: &str = "test_json_query";
429425

430426
run_test(
@@ -472,11 +468,9 @@ async fn test_json_query() {
472468
/// This test case tests whether the response to a GROUP BY can be parsed by
473469
/// deserialize_next_tagged into a tags struct
474470
#[async_std::test]
475-
#[cfg(feature = "use-serde")]
471+
#[cfg(feature = "serde")]
476472
#[cfg(not(tarpaulin_include))]
477473
async fn test_json_query_tagged() {
478-
use serde::Deserialize;
479-
480474
const TEST_NAME: &str = "test_json_query_tagged";
481475

482476
run_test(
@@ -538,12 +532,10 @@ async fn test_json_query_tagged() {
538532
/// (tested with tokio)
539533
#[tokio::test]
540534
#[cfg(all(
541-
feature = "use-serde",
535+
feature = "serde",
542536
not(any(tarpaulin_include, feature = "hyper-client"))
543537
))]
544538
async fn test_json_query_vec() {
545-
use serde::Deserialize;
546-
547539
const TEST_NAME: &str = "test_json_query_vec";
548540

549541
run_test(
@@ -590,11 +582,9 @@ async fn test_json_query_vec() {
590582
///
591583
/// This integration test tests whether using the wrong query method fails building the query
592584
#[async_std::test]
593-
#[cfg(feature = "use-serde")]
585+
#[cfg(feature = "serde")]
594586
#[cfg(not(tarpaulin_include))]
595587
async fn test_serde_multi_query() {
596-
use serde::Deserialize;
597-
598588
const TEST_NAME: &str = "test_serde_multi_query";
599589

600590
run_test(
@@ -666,7 +656,7 @@ async fn test_serde_multi_query() {
666656
///
667657
/// This integration test tests whether using the wrong query method fails building the query
668658
#[async_std::test]
669-
#[cfg(feature = "use-serde")]
659+
#[cfg(feature = "serde")]
670660
#[cfg(not(tarpaulin_include))]
671661
async fn test_wrong_query_errors() {
672662
let client = create_client("test_name");

0 commit comments

Comments
 (0)