Skip to content

Commit

Permalink
Add few docs.rs features annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
blackbeam committed Jan 21, 2025
1 parent bcc336d commit 8a47884
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 4 deletions.
20 changes: 18 additions & 2 deletions src/conn/opts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ pub struct SslOpts {
impl SslOpts {
/// Sets the client identity.
#[cfg(any(feature = "native-tls", feature = "rustls"))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "native-tls",
feature = "rustls-tls",
feature = "rustls-tls-ring"
)))
)]
pub fn with_client_identity(mut self, identity: Option<ClientIdentity>) -> Self {
self.client_identity = identity;
self
Expand Down Expand Up @@ -76,6 +84,14 @@ impl SslOpts {
}

#[cfg(any(feature = "native-tls", feature = "rustls"))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "native-tls",
feature = "rustls-tls",
feature = "rustls-tls-ring"
)))
)]
pub fn client_identity(&self) -> Option<&ClientIdentity> {
self.client_identity.as_ref()
}
Expand Down Expand Up @@ -141,13 +157,13 @@ pub(crate) struct InnerOpts {
/// TCP keep alive interval between subsequent probe for mysql connection.
///
/// Can be defined using `tcp_keepalive_probe_interval_secs` connection url parameter.
#[cfg(any(target_os = "linux", target_os = "macos",))]
#[cfg(any(target_os = "linux", target_os = "macos"))]
tcp_keepalive_probe_interval_secs: Option<u32>,

/// TCP keep alive probe count for mysql connection.
///
/// Can be defined using `tcp_keepalive_probe_count` connection url parameter.
#[cfg(any(target_os = "linux", target_os = "macos",))]
#[cfg(any(target_os = "linux", target_os = "macos"))]
tcp_keepalive_probe_count: Option<u32>,

/// TCP_USER_TIMEOUT time for mysql connection.
Expand Down
8 changes: 8 additions & 0 deletions src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ pub enum Error {
DriverError(DriverError),
UrlError(UrlError),
#[cfg(any(feature = "native-tls", feature = "rustls"))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "native-tls",
feature = "rustls-tls",
feature = "rustls-tls-ring"
)))
)]
TlsError(tls::TlsError),
FromValueError(Value),
FromRowError(Row),
Expand Down
20 changes: 18 additions & 2 deletions src/error/tls/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
#![cfg(any(feature = "native-tls", feature = "rustls"))]

pub mod native_tls_error;
pub mod rustls_error;
mod native_tls_error;
mod rustls_error;

#[cfg(feature = "native-tls")]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "native-tls",
feature = "rustls-tls",
feature = "rustls-tls-ring"
)))
)]
pub use native_tls_error::TlsError;

#[cfg(feature = "rustls")]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "native-tls",
feature = "rustls-tls",
feature = "rustls-tls-ring"
)))
)]
pub use rustls_error::TlsError;
8 changes: 8 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,14 @@ pub mod binlog {
}

#[cfg(any(feature = "native-tls", feature = "rustls"))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "native-tls",
feature = "rustls-tls",
feature = "rustls-tls-ring"
)))
)]
#[doc(inline)]
pub use crate::conn::opts::ClientIdentity;

Expand Down

0 comments on commit 8a47884

Please sign in to comment.