Skip to content

Commit 976a527

Browse files
authored
Merge pull request #299 from blackbeam/fix-features
Fix imports for non-default features
2 parents 5a807d9 + d8fe660 commit 976a527

File tree

13 files changed

+57
-51
lines changed

13 files changed

+57
-51
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,15 @@ rustls-tls = [
117117
"rustls-pemfile",
118118
]
119119

120+
binlog = ["mysql_common/binlog"]
121+
120122
# mysql_common features
121123
derive = ["mysql_common/derive"]
122124
chrono = ["mysql_common/chrono"]
123125
time = ["mysql_common/time"]
124126
bigdecimal = ["mysql_common/bigdecimal"]
125127
rust_decimal = ["mysql_common/rust_decimal"]
126128
frunk = ["mysql_common/frunk"]
127-
binlog = ["mysql_common/binlog"]
128129

129130
# other features
130131
tracing = ["dep:tracing"]

README.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,18 @@ as well as `native-tls`-based TLS support.
3737
mysql_async = { version = "*", default-features = false, features = ["minimal"]}
3838
```
3939

40-
**Note:* it is possible to use another `flate2` backend by directly choosing it:
40+
* `minimal-rust` - same as `minimal` but rust-based flate2 backend is chosen. Enables:
4141

42-
```toml
43-
[dependencies]
44-
mysql_async = { version = "*", default-features = false }
45-
flate2 = { version = "*", default-features = false, features = ["rust_backend"] }
46-
```
42+
- `flate2/rust_backend`
4743

48-
* `default` – enables the following set of crate's and dependencies' features:
44+
* `default` – enables the following set of features:
4945

46+
- `minimal`
5047
- `native-tls-tls`
51-
- `flate2/zlib"
52-
- `mysql_common/bigdecimal03`
53-
- `mysql_common/rust_decimal`
54-
- `mysql_common/time03`
55-
- `mysql_common/uuid`
56-
- `mysql_common/frunk`
48+
- `bigdecimal`
49+
- `rust_decimal`
50+
- `time`
51+
- `frunk`
5752
- `binlog`
5853

5954
* `default-rustls` – same as default but with `rustls-tls` instead of `native-tls-tls`.
@@ -95,12 +90,19 @@ as well as `native-tls`-based TLS support.
9590
mysql_async = { version = "*", features = ["tracing"] }
9691
```
9792

98-
* `derive` – enables `mysql_commom/derive` feature
99-
10093
* `binlog` - enables binlog-related functionality. Enables:
10194

10295
- `mysql_common/binlog"
10396

97+
#### Proxied features
98+
99+
* `derive` – enables `mysql_common/derive` feature
100+
* `chrono` = enables `mysql_common/chrono` feature
101+
* `time` = enables `mysql_common/time` feature
102+
* `bigdecimal` = enables `mysql_common/bigdecimal` feature
103+
* `rust_decimal` = enables `mysql_common/rust_decimal` feature
104+
* `frunk` = enables `mysql_common/frunk` feature
105+
104106
[myslqcommonfeatures]: https://github.com/blackbeam/rust_mysql_common#crate-features
105107

106108
## TLS/SSL Support

azure-pipelines.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ jobs:
4545
SSL=false COMPRESS=true cargo test
4646
SSL=true COMPRESS=true cargo test
4747
SSL=true COMPRESS=false cargo test --no-default-features --features default-rustls
48+
49+
SSL=true COMPRESS=false cargo check --no-default-features --features minimal
50+
SSL=true COMPRESS=false cargo check --no-default-features --features minimal-rust
4851
env:
4952
RUST_BACKTRACE: 1
5053
DATABASE_URL: mysql://root:[email protected]:3306/mysql

src/conn/pool/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use std::{
1414
borrow::Borrow,
1515
cmp::Reverse,
1616
collections::VecDeque,
17-
convert::TryFrom,
1817
hash::{Hash, Hasher},
1918
str::FromStr,
2019
sync::{atomic, Arc, Mutex},

src/error/tls/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
#![cfg(any(feature = "native-tls", feature = "rustls-tls"))]
1+
#![cfg(any(feature = "native-tls-tls", feature = "rustls-tls"))]
22

33
pub mod native_tls_error;
44
pub mod rustls_error;
55

6-
#[cfg(feature = "native-tls")]
6+
#[cfg(feature = "native-tls-tls")]
77
pub use native_tls_error::TlsError;
88

99
#[cfg(feature = "rustls")]

src/error/tls/native_tls_error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![cfg(feature = "native-tls")]
1+
#![cfg(feature = "native-tls-tls")]
22

33
use std::fmt::Display;
44

src/io/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ impl Endpoint {
191191
matches!(self, Endpoint::Secure(_))
192192
}
193193

194-
#[cfg(all(not(feature = "native-tls"), not(feature = "rustls")))]
194+
#[cfg(all(not(feature = "native-tls-tls"), not(feature = "rustls")))]
195195
pub async fn make_secure(
196196
&mut self,
197197
_domain: String,
@@ -499,7 +499,7 @@ mod test {
499499
super::Endpoint::Plain(Some(stream)) => stream,
500500
#[cfg(feature = "rustls-tls")]
501501
super::Endpoint::Secure(tls_stream) => tls_stream.get_ref().0,
502-
#[cfg(feature = "native-tls")]
502+
#[cfg(feature = "native-tls-tls")]
503503
super::Endpoint::Secure(tls_stream) => tls_stream.get_ref().get_ref().get_ref(),
504504
_ => unreachable!(),
505505
};

src/io/tls/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![cfg(any(feature = "native-tls", feature = "rustls"))]
1+
#![cfg(any(feature = "native-tls-tls", feature = "rustls"))]
22

33
mod native_tls_io;
44
mod rustls_io;

src/io/tls/native_tls_io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![cfg(feature = "native-tls")]
1+
#![cfg(feature = "native-tls-tls")]
22

33
use native_tls::{Certificate, TlsConnector};
44

src/lib.rs

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,18 @@
3636
//! mysql_async = { version = "*", default-features = false, features = ["minimal"]}
3737
//! ```
3838
//!
39-
//! **Note:* it is possible to use another `flate2` backend by directly choosing it:
39+
//! * `minimal-rust` - same as `minimal` but rust-based flate2 backend is chosen. Enables:
4040
//!
41-
//! ```toml
42-
//! [dependencies]
43-
//! mysql_async = { version = "*", default-features = false }
44-
//! flate2 = { version = "*", default-features = false, features = ["rust_backend"] }
45-
//! ```
41+
//! - `flate2/rust_backend`
4642
//!
47-
//! * `default` – enables the following set of crate's and dependencies' features:
43+
//! * `default` – enables the following set of features:
4844
//!
45+
//! - `minimal`
4946
//! - `native-tls-tls`
50-
//! - `flate2/zlib"
51-
//! - `mysql_common/bigdecimal03`
52-
//! - `mysql_common/rust_decimal`
53-
//! - `mysql_common/time03`
54-
//! - `mysql_common/uuid`
55-
//! - `mysql_common/frunk`
47+
//! - `bigdecimal`
48+
//! - `rust_decimal`
49+
//! - `time`
50+
//! - `frunk`
5651
//! - `binlog`
5752
//!
5853
//! * `default-rustls` – same as default but with `rustls-tls` instead of `native-tls-tls`.
@@ -94,12 +89,19 @@
9489
//! mysql_async = { version = "*", features = ["tracing"] }
9590
//! ```
9691
//!
97-
//! * `derive` – enables `mysql_commom/derive` feature
98-
//!
9992
//! * `binlog` - enables binlog-related functionality. Enables:
10093
//!
10194
//! - `mysql_common/binlog"
10295
//!
96+
//! ### Proxied features
97+
//!
98+
//! * `derive` – enables `mysql_common/derive` feature
99+
//! * `chrono` = enables `mysql_common/chrono` feature
100+
//! * `time` = enables `mysql_common/time` feature
101+
//! * `bigdecimal` = enables `mysql_common/bigdecimal` feature
102+
//! * `rust_decimal` = enables `mysql_common/rust_decimal` feature
103+
//! * `frunk` = enables `mysql_common/frunk` feature
104+
//!
103105
//! [myslqcommonfeatures]: https://github.com/blackbeam/rust_mysql_common#crate-features
104106
//!
105107
//! # TLS/SSL Support
@@ -464,10 +466,13 @@ pub use self::conn::Conn;
464466
#[doc(inline)]
465467
pub use self::conn::pool::Pool;
466468

469+
#[cfg(any(feature = "native-tls-tls", feature = "rustls-tls"))]
470+
#[doc(inline)]
471+
pub use self::error::tls::TlsError;
472+
467473
#[doc(inline)]
468474
pub use self::error::{
469-
tls::TlsError, DriverError, Error, IoError, LocalInfileError, ParseError, Result, ServerError,
470-
UrlError,
475+
DriverError, Error, IoError, LocalInfileError, ParseError, Result, ServerError, UrlError,
471476
};
472477

473478
#[doc(inline)]
@@ -477,7 +482,7 @@ pub use self::query::QueryWithParams;
477482
pub use self::queryable::transaction::IsolationLevel;
478483

479484
#[doc(inline)]
480-
#[cfg(any(feature = "rustls", feature = "native-tls"))]
485+
#[cfg(any(feature = "rustls", feature = "native-tls-tls"))]
481486
pub use self::opts::ClientIdentity;
482487

483488
#[doc(inline)]

0 commit comments

Comments
 (0)