From 44594e2e036854e777b7ccaf0a86a154c25eb249 Mon Sep 17 00:00:00 2001 From: David Yamnitsky Date: Wed, 5 Aug 2020 10:50:50 -0400 Subject: [PATCH] impl From for AnyConnectOptions --- sqlx-core/src/any/options.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/sqlx-core/src/any/options.rs b/sqlx-core/src/any/options.rs index 0978b577..33a9845e 100644 --- a/sqlx-core/src/any/options.rs +++ b/sqlx-core/src/any/options.rs @@ -60,6 +60,34 @@ pub(crate) enum AnyConnectOptionsKind { Mssql(MssqlConnectOptions), } +#[cfg(feature = "postgres")] +impl From for AnyConnectOptions { + fn from(options: PgConnectOptions) -> Self { + Self(AnyConnectOptionsKind::Postgres(options)) + } +} + +#[cfg(feature = "mysql")] +impl From for AnyConnectOptions { + fn from(options: MySqlConnectOptions) -> Self { + Self(AnyConnectOptionsKind::MySql(options)) + } +} + +#[cfg(feature = "sqlite")] +impl From for AnyConnectOptions { + fn from(options: SqliteConnectOptions) -> Self { + Self(AnyConnectOptionsKind::Sqlite(options)) + } +} + +#[cfg(feature = "mssql")] +impl From for AnyConnectOptions { + fn from(options: MssqlConnectOptions) -> Self { + Self(AnyConnectOptionsKind::Mssql(options)) + } +} + impl FromStr for AnyConnectOptions { type Err = Error;