| 1 | use craterust-analyzer cargo sqlx-core 0.8.3 crate/::anyrust-analyzer cargo sqlx-core 0.8.3 any/::connectionrust-analyzer cargo sqlx-core 0.8.3 any/connection/::AnyConnectionBackendrust-analyzer cargo sqlx-core 0.8.3 any/connection/backend/AnyConnectionBackend#; |
| 2 | use craterust-analyzer cargo sqlx-core 0.8.3 crate/::anyrust-analyzer cargo sqlx-core 0.8.3 any/::{AnyConnectOptionsrust-analyzer cargo sqlx-core 0.8.3 any/options/AnyConnectOptions#, AnyConnectionrust-analyzer cargo sqlx-core 0.8.3 any/connection/AnyConnection#}; |
| 3 | use craterust-analyzer cargo sqlx-core 0.8.3 crate/::commonrust-analyzer cargo sqlx-core 0.8.3 common/::DebugFnrust-analyzer cargo sqlx-core 0.8.3 common/DebugFn#; |
| 4 | use craterust-analyzer cargo sqlx-core 0.8.3 crate/::connectionrust-analyzer cargo sqlx-core 0.8.3 connection/::Connectionrust-analyzer cargo sqlx-core 0.8.3 connection/Connection#; |
| 5 | use craterust-analyzer cargo sqlx-core 0.8.3 crate/::databaserust-analyzer cargo sqlx-core 0.8.3 database/::Databaserust-analyzer cargo sqlx-core 0.8.3 database/Database#; |
| 6 | use craterust-analyzer cargo sqlx-core 0.8.3 crate/::Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#; |
| 7 | use futures_corerust-analyzer cargo futures-core 0.3.34 crate/::futurerust-analyzer cargo futures-core 0.3.34 future/::BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#; |
| 8 | use once_cellrust-analyzer cargo once_cell 1.21.4 crate/::syncrust-analyzer cargo once_cell 1.21.4 sync/::OnceCellrust-analyzer cargo once_cell 1.21.4 sync/OnceCell#; |
| 9 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::{Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#, Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#}; |
| 10 | use urlrust-analyzer cargo url 2.5.8 crate/::Urlrust-analyzer cargo url 2.5.8 Url#; |
| 11 | |
| 12 | static DRIVERSrust-analyzer cargo sqlx-core 0.8.3 any/driver/DRIVERS.: OnceCellrust-analyzer cargo once_cell 1.21.4 sync/OnceCell#<&'static [AnyDriverrust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyDriver#]> = OnceCellrust-analyzer cargo once_cell 1.21.4 sync/OnceCell#::newrust-analyzer cargo once_cell 1.21.4 sync/impl#[`OnceCell<T>`]new().(); |
| 13 | |
| 14 | #[macro_export] |
| 15 | macro_rules! declare_driver_with_optional_migraterust-analyzer cargo sqlx-core 0.8.3 any/driver/declare_driver_with_optional_migrate! { |
| 16 | ($name:ident = $db:path) => { |
| 17 | #[cfg(feature = "migrate")] |
| 18 | pub const $name: $crate::any::driver::AnyDriver = |
| 19 | $crate::any::driver::AnyDriver::with_migrate::<$db>(); |
| 20 | |
| 21 | #[cfg(not(feature = "migrate"))] |
| 22 | pub const $name: $crate::any::driver::AnyDriver = |
| 23 | $crate::any::driver::AnyDriver::without_migrate::<$db>(); |
| 24 | }; |
| 25 | } |
| 26 | |
| 27 | #[non_exhaustive] |
| 28 | pub struct AnyDriverrust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyDriver# { |
| 29 | pub(craterust-analyzer cargo sqlx-core 0.8.3 crate/) namerust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyDriver#name.: &'static str, |
| 30 | pub(craterust-analyzer cargo sqlx-core 0.8.3 crate/) url_schemesrust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyDriver#url_schemes.: &'static [&'static str], |
| 31 | pub(craterust-analyzer cargo sqlx-core 0.8.3 crate/) connectrust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyDriver#connect.: |
| 32 | DebugFnrust-analyzer cargo sqlx-core 0.8.3 common/DebugFn#<fn(&AnyConnectOptionsrust-analyzer cargo sqlx-core 0.8.3 any/options/AnyConnectOptions#) -> BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#<'_, craterust-analyzer cargo sqlx-core 0.8.3 crate/::Resultrust-analyzer cargo sqlx-core 0.8.3 error/Result#<AnyConnectionrust-analyzer cargo sqlx-core 0.8.3 any/connection/AnyConnection#>>>, |
| 33 | pub(craterust-analyzer cargo sqlx-core 0.8.3 crate/) migrate_databaserust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyDriver#migrate_database.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<AnyMigrateDatabaserust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyMigrateDatabase#>, |
| 34 | } |
| 35 | |
| 36 | impl AnyDriverrust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyDriver# { |
| 37 | pub const fn without_migraterust-analyzer cargo sqlx-core 0.8.3 any/driver/impl#[AnyDriver]without_migrate().<DB: Databaserust-analyzer cargo sqlx-core 0.8.3 database/Database#>() -> Selfrust-analyzer cargo sqlx-core 0.8.3 any/driver/impl#[AnyDriver] |
| 38 | where |
| 39 | DB::Connectionrust-analyzer cargo sqlx-core 0.8.3 database/Database#Connection#: AnyConnectionBackendrust-analyzer cargo sqlx-core 0.8.3 any/connection/backend/AnyConnectionBackend#, |
| 40 | <DB::Connectionrust-analyzer cargo sqlx-core 0.8.3 database/Database#Connection# as Connectionrust-analyzer cargo sqlx-core 0.8.3 connection/Connection#>::Optionsrust-analyzer cargo sqlx-core 0.8.3 connection/Connection#Options#: |
| 41 | for<'a> TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<&'a AnyConnectOptionsrust-analyzer cargo sqlx-core 0.8.3 any/options/AnyConnectOptions#, Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#Error# = Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>, |
| 42 | { |
| 43 | Selfrust-analyzer cargo sqlx-core 0.8.3 any/driver/impl#[AnyDriver] { |
| 44 | namerust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyDriver#name.: DB::NAMErust-analyzer cargo sqlx-core 0.8.3 database/Database#NAME., |
| 45 | url_schemesrust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyDriver#url_schemes.: DB::URL_SCHEMESrust-analyzer cargo sqlx-core 0.8.3 database/Database#URL_SCHEMES., |
| 46 | connectrust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyDriver#connect.: DebugFnrust-analyzer cargo sqlx-core 0.8.3 common/DebugFn#(AnyConnectionrust-analyzer cargo sqlx-core 0.8.3 any/connection/AnyConnection#::connect_with_dbrust-analyzer cargo sqlx-core 0.8.3 any/connection/impl#[AnyConnection]connect_with_db().::<DB>), |
| 47 | migrate_databaserust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyDriver#migrate_database.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | #[cfg(not(feature = "migrate"))] |
| 52 | pub const fn with_migrate<DB: Databaserust-analyzer cargo sqlx-core 0.8.3 database/Database#>() -> Selfrust-analyzer cargo sqlx-core 0.8.3 any/driver/impl#[AnyDriver] |
| 53 | where |
| 54 | DB::Connection: AnyConnectionBackendrust-analyzer cargo sqlx-core 0.8.3 any/connection/backend/AnyConnectionBackend#, |
| 55 | <DB::Connection as Connectionrust-analyzer cargo sqlx-core 0.8.3 connection/Connection#>::Optionsrust-analyzer cargo sqlx-core 0.8.3 connection/Connection#Options#: |
| 56 | for<'a> TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<&'a AnyConnectOptionsrust-analyzer cargo sqlx-core 0.8.3 any/options/AnyConnectOptions#, Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#Error# = Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>, |
| 57 | { |
| 58 | Selfrust-analyzer cargo sqlx-core 0.8.3 any/driver/impl#[AnyDriver]::without_migrate::<DB>() |
| 59 | } |
| 60 | |
| 61 | #[cfg(feature = "migrate")] |
| 62 | pub const fn with_migraterust-analyzer cargo sqlx-core 0.8.3 any/driver/impl#[AnyDriver]with_migrate().<DB: Databaserust-analyzer cargo sqlx-core 0.8.3 database/Database# + craterust-analyzer cargo sqlx-core 0.8.3 crate/::migraterust-analyzer cargo sqlx-core 0.8.3 migrate/::MigrateDatabaserust-analyzer cargo sqlx-core 0.8.3 migrate/migrate/MigrateDatabase#>() -> Selfrust-analyzer cargo sqlx-core 0.8.3 any/driver/impl#[AnyDriver] |
| 63 | where |
| 64 | DB::Connectionrust-analyzer cargo sqlx-core 0.8.3 database/Database#Connection#: AnyConnectionBackendrust-analyzer cargo sqlx-core 0.8.3 any/connection/backend/AnyConnectionBackend#, |
| 65 | <DB::Connectionrust-analyzer cargo sqlx-core 0.8.3 database/Database#Connection# as Connectionrust-analyzer cargo sqlx-core 0.8.3 connection/Connection#>::Optionsrust-analyzer cargo sqlx-core 0.8.3 connection/Connection#Options#: |
| 66 | for<'a> TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<&'a AnyConnectOptionsrust-analyzer cargo sqlx-core 0.8.3 any/options/AnyConnectOptions#, Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#Error# = Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>, |
| 67 | { |
| 68 | Selfrust-analyzer cargo sqlx-core 0.8.3 any/driver/impl#[AnyDriver] { |
| 69 | migrate_databaserust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyDriver#migrate_database.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(AnyMigrateDatabaserust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyMigrateDatabase# { |
| 70 | create_databaserust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyMigrateDatabase#create_database.: DebugFnrust-analyzer cargo sqlx-core 0.8.3 common/DebugFn#(DB::create_databaserust-analyzer cargo sqlx-core 0.8.3 migrate/migrate/MigrateDatabase#create_database().), |
| 71 | database_existsrust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyMigrateDatabase#database_exists.: DebugFnrust-analyzer cargo sqlx-core 0.8.3 common/DebugFn#(DB::database_existsrust-analyzer cargo sqlx-core 0.8.3 migrate/migrate/MigrateDatabase#database_exists().), |
| 72 | drop_databaserust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyMigrateDatabase#drop_database.: DebugFnrust-analyzer cargo sqlx-core 0.8.3 common/DebugFn#(DB::drop_databaserust-analyzer cargo sqlx-core 0.8.3 migrate/migrate/MigrateDatabase#drop_database().), |
| 73 | force_drop_databaserust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyMigrateDatabase#force_drop_database.: DebugFnrust-analyzer cargo sqlx-core 0.8.3 common/DebugFn#(DB::force_drop_databaserust-analyzer cargo sqlx-core 0.8.3 migrate/migrate/MigrateDatabase#force_drop_database().), |
| 74 | }), |
| 75 | ..Selfrust-analyzer cargo sqlx-core 0.8.3 any/driver/impl#[AnyDriver]::without_migraterust-analyzer cargo sqlx-core 0.8.3 any/driver/impl#[AnyDriver]without_migrate().::<DB>() |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | pub fn get_migrate_databaserust-analyzer cargo sqlx-core 0.8.3 any/driver/impl#[AnyDriver]get_migrate_database().(&self) -> craterust-analyzer cargo sqlx-core 0.8.3 crate/::Resultrust-analyzer cargo sqlx-core 0.8.3 error/Result#<&AnyMigrateDatabaserust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyMigrateDatabase#> { |
| 80 | self.migrate_databaserust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyDriver#migrate_database..as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() |
| 81 | .ok_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or_else().(|| Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#::Configurationrust-analyzer cargo sqlx-core 0.8.3 error/Error#Configuration#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{} driver does not support migrations or the `migrate` feature was not enabled for it", self.namerust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyDriver#name.).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | impl Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for AnyDriverrust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyDriver# { |
| 86 | fn fmtrust-analyzer cargo sqlx-core 0.8.3 any/driver/impl#[AnyDriver][Debug]fmt().(&self, f: &mut Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 87 | f.debug_structrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]debug_struct().("AnyDriver") |
| 88 | .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]field().("name", &self.namerust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyDriver#name.) |
| 89 | .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]field().("url_schemes", &self.url_schemesrust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyDriver#url_schemes.) |
| 90 | .finishrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]finish().() |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | pub struct AnyMigrateDatabaserust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyMigrateDatabase# { |
| 95 | create_databaserust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyMigrateDatabase#create_database.: DebugFnrust-analyzer cargo sqlx-core 0.8.3 common/DebugFn#<fn(&str) -> BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#<'_, craterust-analyzer cargo sqlx-core 0.8.3 crate/::Resultrust-analyzer cargo sqlx-core 0.8.3 error/Result#<()>>>, |
| 96 | database_existsrust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyMigrateDatabase#database_exists.: DebugFnrust-analyzer cargo sqlx-core 0.8.3 common/DebugFn#<fn(&str) -> BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#<'_, craterust-analyzer cargo sqlx-core 0.8.3 crate/::Resultrust-analyzer cargo sqlx-core 0.8.3 error/Result#<bool>>>, |
| 97 | drop_databaserust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyMigrateDatabase#drop_database.: DebugFnrust-analyzer cargo sqlx-core 0.8.3 common/DebugFn#<fn(&str) -> BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#<'_, craterust-analyzer cargo sqlx-core 0.8.3 crate/::Resultrust-analyzer cargo sqlx-core 0.8.3 error/Result#<()>>>, |
| 98 | force_drop_databaserust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyMigrateDatabase#force_drop_database.: DebugFnrust-analyzer cargo sqlx-core 0.8.3 common/DebugFn#<fn(&str) -> BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#<'_, craterust-analyzer cargo sqlx-core 0.8.3 crate/::Resultrust-analyzer cargo sqlx-core 0.8.3 error/Result#<()>>>, |
| 99 | } |
| 100 | |
| 101 | impl AnyMigrateDatabaserust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyMigrateDatabase# { |
| 102 | pub fn create_databaserust-analyzer cargo sqlx-core 0.8.3 any/driver/impl#[AnyMigrateDatabase]create_database().<'a>(&self, url: &'a str) -> BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#<'a, craterust-analyzer cargo sqlx-core 0.8.3 crate/::Resultrust-analyzer cargo sqlx-core 0.8.3 error/Result#<()>> { |
| 103 | (self.create_databaserust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyMigrateDatabase#create_database.)(url) |
| 104 | } |
| 105 | |
| 106 | pub fn database_existsrust-analyzer cargo sqlx-core 0.8.3 any/driver/impl#[AnyMigrateDatabase]database_exists().<'a>(&self, url: &'a str) -> BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#<'a, craterust-analyzer cargo sqlx-core 0.8.3 crate/::Resultrust-analyzer cargo sqlx-core 0.8.3 error/Result#<bool>> { |
| 107 | (self.database_existsrust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyMigrateDatabase#database_exists.)(url) |
| 108 | } |
| 109 | |
| 110 | pub fn drop_databaserust-analyzer cargo sqlx-core 0.8.3 any/driver/impl#[AnyMigrateDatabase]drop_database().<'a>(&self, url: &'a str) -> BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#<'a, craterust-analyzer cargo sqlx-core 0.8.3 crate/::Resultrust-analyzer cargo sqlx-core 0.8.3 error/Result#<()>> { |
| 111 | (self.drop_databaserust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyMigrateDatabase#drop_database.)(url) |
| 112 | } |
| 113 | |
| 114 | pub fn force_drop_databaserust-analyzer cargo sqlx-core 0.8.3 any/driver/impl#[AnyMigrateDatabase]force_drop_database().<'a>(&self, url: &'a str) -> BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#<'a, craterust-analyzer cargo sqlx-core 0.8.3 crate/::Resultrust-analyzer cargo sqlx-core 0.8.3 error/Result#<()>> { |
| 115 | (self.force_drop_databaserust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyMigrateDatabase#force_drop_database.)(url) |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | /// Install the list of drivers for [`AnyConnection`] to use. |
| 120 | /// |
| 121 | /// Must be called before an `AnyConnection` or `AnyPool` can be connected. |
| 122 | /// |
| 123 | /// ### Errors |
| 124 | /// If called more than once. |
| 125 | pub fn install_driversrust-analyzer cargo sqlx-core 0.8.3 any/driver/install_drivers().( |
| 126 | drivers: &'static [AnyDriverrust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyDriver#], |
| 127 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# + Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send# + Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# + 'static>> { |
| 128 | DRIVERSrust-analyzer cargo sqlx-core 0.8.3 any/driver/DRIVERS. |
| 129 | .setrust-analyzer cargo once_cell 1.21.4 sync/impl#[`OnceCell<T>`]set().(drivers) |
| 130 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| "drivers already installed".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 131 | } |
| 132 | |
| 133 | pub(craterust-analyzer cargo sqlx-core 0.8.3 crate/) fn from_url_strrust-analyzer cargo sqlx-core 0.8.3 any/driver/from_url_str().(url: &str) -> craterust-analyzer cargo sqlx-core 0.8.3 crate/::Resultrust-analyzer cargo sqlx-core 0.8.3 error/Result#<&'static AnyDriverrust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyDriver#> { |
| 134 | from_urlrust-analyzer cargo sqlx-core 0.8.3 any/driver/from_url().(&url.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().().map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#::configrust-analyzer cargo sqlx-core 0.8.3 error/impl#[Error]config().)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().) |
| 135 | } |
| 136 | |
| 137 | pub(craterust-analyzer cargo sqlx-core 0.8.3 crate/) fn from_urlrust-analyzer cargo sqlx-core 0.8.3 any/driver/from_url().(url: &Urlrust-analyzer cargo url 2.5.8 Url#) -> craterust-analyzer cargo sqlx-core 0.8.3 crate/::Resultrust-analyzer cargo sqlx-core 0.8.3 error/Result#<&'static AnyDriverrust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyDriver#> { |
| 138 | let scheme = url.schemerust-analyzer cargo url 2.5.8 impl#[Url]scheme().(); |
| 139 | |
| 140 | let drivers: &[AnyDriverrust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyDriver#] = DRIVERSrust-analyzer cargo sqlx-core 0.8.3 any/driver/DRIVERS. |
| 141 | .getrust-analyzer cargo once_cell 1.21.4 sync/impl#[`OnceCell<T>`]get().() |
| 142 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("No drivers installed. Please see the documentation in `sqlx::any` for details."); |
| 143 | |
| 144 | drivers |
| 145 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 146 | .findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]find().(|driver| driver.url_schemesrust-analyzer cargo sqlx-core 0.8.3 any/driver/AnyDriver#url_schemes..containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&url.schemerust-analyzer cargo url 2.5.8 impl#[Url]scheme().())) |
| 147 | .ok_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or_else().(|| { |
| 148 | Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#::Configurationrust-analyzer cargo sqlx-core 0.8.3 error/Error#Configuration#(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("no driver found for URL scheme {scheme:?}").intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 149 | }) |
| 150 | } |