mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 14:34:19 +00:00
Merge pull request #85 from yaahc/unstable-features
Add doc_cfg attributes for conditional portions of the API
This commit is contained in:
commit
214467841d
8 changed files with 18 additions and 1 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1711,7 +1711,7 @@ dependencies = [
|
|||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ authors = [
|
|||
|
||||
[package.metadata.docs.rs]
|
||||
features = [ "tls", "postgres", "mysql", "uuid", "chrono" ]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
|
||||
[features]
|
||||
default = [ "macros", "runtime-async-std" ]
|
||||
|
|
|
@ -148,6 +148,7 @@ impl From<ProtocolError<'_>> for Error {
|
|||
}
|
||||
|
||||
#[cfg(feature = "tls")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "tls")))]
|
||||
impl From<async_native_tls::Error> for Error {
|
||||
#[inline]
|
||||
fn from(err: async_native_tls::Error) -> Self {
|
||||
|
|
|
@ -40,6 +40,7 @@ impl MaybeTlsStream {
|
|||
}
|
||||
|
||||
#[cfg(feature = "tls")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "tls")))]
|
||||
pub async fn upgrade(
|
||||
&mut self,
|
||||
url: &Url,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#![recursion_limit = "256"]
|
||||
#![forbid(unsafe_code)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
|
||||
#[macro_use]
|
||||
pub mod error;
|
||||
|
@ -37,9 +38,11 @@ pub mod types;
|
|||
pub mod row;
|
||||
|
||||
#[cfg(feature = "mysql")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "mysql")))]
|
||||
pub mod mysql;
|
||||
|
||||
#[cfg(feature = "postgres")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "postgres")))]
|
||||
pub mod postgres;
|
||||
|
||||
pub use database::Database;
|
||||
|
@ -63,9 +66,11 @@ pub use pool::Pool;
|
|||
pub use row::{FromRow, Row};
|
||||
|
||||
#[cfg(feature = "mysql")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "mysql")))]
|
||||
#[doc(inline)]
|
||||
pub use mysql::MySql;
|
||||
|
||||
#[cfg(feature = "postgres")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "postgres")))]
|
||||
#[doc(inline)]
|
||||
pub use postgres::Postgres;
|
||||
|
|
|
@ -5,9 +5,11 @@ use std::fmt::{Debug, Display};
|
|||
use crate::Database;
|
||||
|
||||
#[cfg(feature = "uuid")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "uuid")))]
|
||||
pub use uuid::Uuid;
|
||||
|
||||
#[cfg(feature = "chrono")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "chrono")))]
|
||||
pub mod chrono {
|
||||
pub use chrono::{DateTime, NaiveDate, NaiveDateTime, NaiveTime, Utc};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#![allow(dead_code)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
|
||||
#[cfg(not(any(feature = "runtime-tokio", feature = "runtime-async-std")))]
|
||||
compile_error!("one of 'runtime-async-std' or 'runtime-tokio' features must be enabled");
|
||||
|
@ -21,9 +22,11 @@ pub use sqlx_core::{query, query_as};
|
|||
pub use sqlx_core::query_as_mapped;
|
||||
|
||||
#[cfg(feature = "mysql")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "mysql")))]
|
||||
pub use sqlx_core::mysql::{self, MySql, MySqlConnection, MySqlPool};
|
||||
|
||||
#[cfg(feature = "postgres")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "postgres")))]
|
||||
pub use sqlx_core::postgres::{self, PgConnection, PgPool, Postgres};
|
||||
|
||||
#[cfg(feature = "macros")]
|
||||
|
|
|
@ -83,6 +83,7 @@
|
|||
/// * [query_file!] if you want to define the SQL query out-of-line,
|
||||
/// * [query_file_as!] if you want both of the above.
|
||||
#[macro_export]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
|
||||
macro_rules! query (
|
||||
// by emitting a macro definition from our proc-macro containing the result tokens,
|
||||
// we no longer have a need for `proc-macro-hack`
|
||||
|
@ -145,6 +146,7 @@ macro_rules! query (
|
|||
/// # fn main() {}
|
||||
/// ```
|
||||
#[macro_export]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
|
||||
macro_rules! query_file (
|
||||
($query:literal) => (#[allow(dead_code)]{
|
||||
#[macro_use]
|
||||
|
@ -210,6 +212,7 @@ macro_rules! query_file (
|
|||
/// # fn main() {}
|
||||
/// ```
|
||||
#[macro_export]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
|
||||
macro_rules! query_as (
|
||||
($out_struct:path, $query:literal) => (#[allow(dead_code)] {
|
||||
#[macro_use]
|
||||
|
@ -260,6 +263,7 @@ macro_rules! query_as (
|
|||
/// # fn main() {}
|
||||
/// ```
|
||||
#[macro_export]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
|
||||
macro_rules! query_file_as (
|
||||
($out_struct:path, $query:literal) => (#[allow(dead_code)] {
|
||||
#[macro_use]
|
||||
|
|
Loading…
Reference in a new issue