mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-04-23 23:17:08 +00:00
make sqlx_core::runtime private and add a runtime module to sqlx-macros
This commit is contained in:
@@ -7,6 +7,9 @@
|
||||
#![cfg_attr(not(feature = "sqlite"), forbid(unsafe_code))]
|
||||
#![recursion_limit = "512"]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
// #![warn(missing_docs)]
|
||||
|
||||
mod runtime;
|
||||
|
||||
#[macro_use]
|
||||
pub mod error;
|
||||
@@ -25,9 +28,6 @@ pub mod executor;
|
||||
pub mod transaction;
|
||||
mod url;
|
||||
|
||||
#[doc(hidden)]
|
||||
pub mod runtime;
|
||||
|
||||
#[macro_use]
|
||||
pub mod arguments;
|
||||
pub mod decode;
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
#[cfg(not(any(feature = "runtime-tokio", feature = "runtime-async-std")))]
|
||||
compile_error!("one of 'runtime-async-std' or 'runtime-tokio' features must be enabled");
|
||||
|
||||
#[cfg(all(feature = "runtime-tokio", feature = "runtime-async-std"))]
|
||||
compile_error!("only one of 'runtime-async-std' or 'runtime-tokio' features must be enabled");
|
||||
|
||||
#[cfg(feature = "runtime-async-std")]
|
||||
pub use async_std::{
|
||||
fs,
|
||||
pub(crate) use async_std::{
|
||||
future::timeout,
|
||||
io::prelude::{ReadExt as AsyncReadExt, WriteExt as AsyncWriteExt},
|
||||
io::prelude::ReadExt as AsyncReadExt,
|
||||
io::{Read as AsyncRead, Write as AsyncWrite},
|
||||
net::TcpStream,
|
||||
task::sleep,
|
||||
task::spawn,
|
||||
task::yield_now,
|
||||
};
|
||||
|
||||
#[cfg(feature = "runtime-tokio")]
|
||||
pub use tokio::{
|
||||
fs,
|
||||
io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt},
|
||||
pub(crate) use tokio::{
|
||||
io::{AsyncRead, AsyncReadExt, AsyncWrite},
|
||||
net::TcpStream,
|
||||
task::spawn,
|
||||
task::yield_now,
|
||||
time::delay_for as sleep,
|
||||
time::timeout,
|
||||
};
|
||||
|
||||
@@ -18,10 +18,9 @@ type Error = Box<dyn std::error::Error>;
|
||||
type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
mod database;
|
||||
|
||||
mod derives;
|
||||
|
||||
mod query_macros;
|
||||
mod runtime;
|
||||
|
||||
use query_macros::*;
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@ use syn::{ExprGroup, Token};
|
||||
|
||||
use sqlx::connection::Connection;
|
||||
use sqlx::describe::Describe;
|
||||
use sqlx::runtime::fs;
|
||||
|
||||
use crate::runtime::fs;
|
||||
|
||||
/// Macro input shared by `query!()` and `query_file!()`
|
||||
pub struct QueryMacroInput {
|
||||
|
||||
11
sqlx-macros/src/runtime.rs
Normal file
11
sqlx-macros/src/runtime.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
#[cfg(not(any(feature = "runtime-tokio", feature = "runtime-async-std")))]
|
||||
compile_error!("one of 'runtime-async-std' or 'runtime-tokio' features must be enabled");
|
||||
|
||||
#[cfg(all(feature = "runtime-tokio", feature = "runtime-async-std"))]
|
||||
compile_error!("only one of 'runtime-async-std' or 'runtime-tokio' features must be enabled");
|
||||
|
||||
#[cfg(feature = "runtime-async-std")]
|
||||
pub(crate) use async_std::fs;
|
||||
|
||||
#[cfg(feature = "runtime-tokio")]
|
||||
pub(crate) use tokio::fs;
|
||||
@@ -1,11 +1,5 @@
|
||||
#![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");
|
||||
|
||||
#[cfg(all(feature = "runtime-tokio", feature = "runtime-async-std"))]
|
||||
compile_error!("only one of 'runtime-async-std' or 'runtime-tokio' features must be enabled");
|
||||
|
||||
pub use sqlx_core::arguments;
|
||||
pub use sqlx_core::connection::{Connect, Connection};
|
||||
pub use sqlx_core::cursor::Cursor;
|
||||
|
||||
Reference in New Issue
Block a user