diff --git a/sqlx-core/src/any/mod.rs b/sqlx-core/src/any/mod.rs index be6ea90c5..a5f794820 100644 --- a/sqlx-core/src/any/mod.rs +++ b/sqlx-core/src/any/mod.rs @@ -35,7 +35,6 @@ pub use encode::AnyEncode; pub use kind::AnyKind; pub use options::AnyConnectOptions; pub use query_result::AnyQueryResult; -pub use r#type::AnyType; pub use row::AnyRow; pub use statement::AnyStatement; pub use transaction::AnyTransactionManager; diff --git a/sqlx-core/src/any/type.rs b/sqlx-core/src/any/type.rs index 4a9a3aa99..3df4136b6 100644 --- a/sqlx-core/src/any/type.rs +++ b/sqlx-core/src/any/type.rs @@ -1,17 +1,3 @@ -use crate::types::Type; - -#[cfg(feature = "postgres")] -use crate::postgres::Postgres; - -#[cfg(feature = "mysql")] -use crate::mysql::MySql; - -#[cfg(feature = "mssql")] -use crate::mssql::Mssql; - -#[cfg(feature = "sqlite")] -use crate::sqlite::Sqlite; - // Type is required by the bounds of the [`Row`] and [`Arguments`] trait but its been overridden in // AnyRow and AnyArguments to not use this implementation; but instead, delegate to the // database-specific implementation. @@ -20,10 +6,7 @@ use crate::sqlite::Sqlite; // for the [`Any`] driver. macro_rules! impl_any_type { ($ty:ty) => { - impl crate::types::Type for $ty - where - $ty: crate::any::AnyType, - { + impl crate::types::Type for $ty { fn type_info() -> crate::any::AnyTypeInfo { // FIXME: nicer panic explaining why this isn't possible unimplemented!() @@ -55,198 +38,3 @@ macro_rules! impl_any_type { } }; } - -// FIXME: Find a nice way to auto-generate the below or petition Rust to add support for #[cfg] -// to trait bounds - -// all 4 - -#[cfg(all( - feature = "postgres", - feature = "mysql", - feature = "mssql", - feature = "sqlite" -))] -pub trait AnyType: Type + Type + Type + Type {} - -#[cfg(all( - feature = "postgres", - feature = "mysql", - feature = "mssql", - feature = "sqlite" -))] -impl AnyType for T where T: Type + Type + Type + Type {} - -// only 3 (4) - -#[cfg(all( - not(feature = "mssql"), - all(feature = "postgres", feature = "mysql", feature = "sqlite") -))] -pub trait AnyType: Type + Type + Type {} - -#[cfg(all( - not(feature = "mssql"), - all(feature = "postgres", feature = "mysql", feature = "sqlite") -))] -impl AnyType for T where T: Type + Type + Type {} - -#[cfg(all( - not(feature = "mysql"), - all(feature = "postgres", feature = "mssql", feature = "sqlite") -))] -pub trait AnyType: Type + Type + Type {} - -#[cfg(all( - not(feature = "mysql"), - all(feature = "postgres", feature = "mssql", feature = "sqlite") -))] -impl AnyType for T where T: Type + Type + Type {} - -#[cfg(all( - not(feature = "sqlite"), - all(feature = "postgres", feature = "mysql", feature = "mssql") -))] -pub trait AnyType: Type + Type + Type {} - -#[cfg(all( - not(feature = "sqlite"), - all(feature = "postgres", feature = "mysql", feature = "mssql") -))] -impl AnyType for T where T: Type + Type + Type {} - -#[cfg(all( - not(feature = "postgres"), - all(feature = "sqlite", feature = "mysql", feature = "mssql") -))] -pub trait AnyType: Type + Type + Type {} - -#[cfg(all( - not(feature = "postgres"), - all(feature = "sqlite", feature = "mysql", feature = "mssql") -))] -impl AnyType for T where T: Type + Type + Type {} - -// only 2 (6) - -#[cfg(all( - not(any(feature = "mssql", feature = "sqlite")), - all(feature = "postgres", feature = "mysql") -))] -pub trait AnyType: Type + Type {} - -#[cfg(all( - not(any(feature = "mssql", feature = "sqlite")), - all(feature = "postgres", feature = "mysql") -))] -impl AnyType for T where T: Type + Type {} - -#[cfg(all( - not(any(feature = "mysql", feature = "sqlite")), - all(feature = "postgres", feature = "mssql") -))] -pub trait AnyType: Type + Type {} - -#[cfg(all( - not(any(feature = "mysql", feature = "sqlite")), - all(feature = "postgres", feature = "mssql") -))] -impl AnyType for T where T: Type + Type {} - -#[cfg(all( - not(any(feature = "mysql", feature = "mssql")), - all(feature = "postgres", feature = "sqlite") -))] -pub trait AnyType: Type + Type {} - -#[cfg(all( - not(any(feature = "mysql", feature = "mssql")), - all(feature = "postgres", feature = "sqlite") -))] -impl AnyType for T where T: Type + Type {} - -#[cfg(all( - not(any(feature = "postgres", feature = "sqlite")), - all(feature = "mssql", feature = "mysql") -))] -pub trait AnyType: Type + Type {} - -#[cfg(all( - not(any(feature = "postgres", feature = "sqlite")), - all(feature = "mssql", feature = "mysql") -))] -impl AnyType for T where T: Type + Type {} - -#[cfg(all( - not(any(feature = "postgres", feature = "mysql")), - all(feature = "mssql", feature = "sqlite") -))] -pub trait AnyType: Type + Type {} - -#[cfg(all( - not(any(feature = "postgres", feature = "mysql")), - all(feature = "mssql", feature = "sqlite") -))] -impl AnyType for T where T: Type + Type {} - -#[cfg(all( - not(any(feature = "postgres", feature = "mssql")), - all(feature = "mysql", feature = "sqlite") -))] -pub trait AnyType: Type + Type {} - -#[cfg(all( - not(any(feature = "postgres", feature = "mssql")), - all(feature = "mysql", feature = "sqlite") -))] -impl AnyType for T where T: Type + Type {} - -// only 1 (4) - -#[cfg(all( - not(any(feature = "mysql", feature = "mssql", feature = "sqlite")), - feature = "postgres" -))] -pub trait AnyType: Type {} - -#[cfg(all( - not(any(feature = "mysql", feature = "mssql", feature = "sqlite")), - feature = "postgres" -))] -impl AnyType for T where T: Type {} - -#[cfg(all( - not(any(feature = "postgres", feature = "mssql", feature = "sqlite")), - feature = "mysql" -))] -pub trait AnyType: Type {} - -#[cfg(all( - not(any(feature = "postgres", feature = "mssql", feature = "sqlite")), - feature = "mysql" -))] -impl AnyType for T where T: Type {} - -#[cfg(all( - not(any(feature = "mysql", feature = "postgres", feature = "sqlite")), - feature = "mssql" -))] -pub trait AnyType: Type {} - -#[cfg(all( - not(any(feature = "mysql", feature = "postgres", feature = "sqlite")), - feature = "mssql" -))] -impl AnyType for T where T: Type {} - -#[cfg(all( - not(any(feature = "mysql", feature = "mssql", feature = "postgres")), - feature = "sqlite" -))] -pub trait AnyType: Type {} - -#[cfg(all( - not(any(feature = "mysql", feature = "mssql", feature = "postgres")), - feature = "sqlite" -))] -impl AnyType for T where T: Type {}