| 1 | use craterust-analyzer cargo sqlx-core 0.8.3 crate/::anyrust-analyzer cargo sqlx-core 0.8.3 any/::AnyConnectionrust-analyzer cargo sqlx-core 0.8.3 any/connection/AnyConnection#; |
| 2 | use craterust-analyzer cargo sqlx-core 0.8.3 crate/::connectionrust-analyzer cargo sqlx-core 0.8.3 connection/::{ConnectOptionsrust-analyzer cargo sqlx-core 0.8.3 connection/ConnectOptions#, LogSettingsrust-analyzer cargo sqlx-core 0.8.3 connection/LogSettings#}; |
| 3 | use craterust-analyzer cargo sqlx-core 0.8.3 crate/::errorrust-analyzer cargo sqlx-core 0.8.3 error/::Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#; |
| 4 | 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#; |
| 5 | use logrust-analyzer cargo log 0.4.34 crate/::LevelFilterrust-analyzer cargo log 0.4.34 LevelFilter#; |
| 6 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#; |
| 7 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::timerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/::Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#; |
| 8 | use urlrust-analyzer cargo url 2.5.8 crate/::Urlrust-analyzer cargo url 2.5.8 Url#; |
| 9 | |
| 10 | /// Opaque options for connecting to a database. These may only be constructed by parsing from |
| 11 | /// a connection url. |
| 12 | /// |
| 13 | /// ```text |
| 14 | /// postgres://postgres:password@localhost/database |
| 15 | /// mysql://root:password@localhost/database |
| 16 | /// ``` |
| 17 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 18 | #[non_exhaustive] |
| 19 | pub struct AnyConnectOptionsrust-analyzer cargo sqlx-core 0.8.3 any/options/AnyConnectOptions# { |
| 20 | pub database_urlrust-analyzer cargo sqlx-core 0.8.3 any/options/AnyConnectOptions#database_url.: Urlrust-analyzer cargo url 2.5.8 Url#, |
| 21 | pub log_settingsrust-analyzer cargo sqlx-core 0.8.3 any/options/AnyConnectOptions#log_settings.: LogSettingsrust-analyzer cargo sqlx-core 0.8.3 connection/LogSettings#, |
| 22 | } |
| 23 | impl FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr# for AnyConnectOptionsrust-analyzer cargo sqlx-core 0.8.3 any/options/AnyConnectOptions# { |
| 24 | type Errrust-analyzer cargo sqlx-core 0.8.3 any/options/impl#[AnyConnectOptions][FromStr]Err# = Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#; |
| 25 | |
| 26 | fn from_strrust-analyzer cargo sqlx-core 0.8.3 any/options/impl#[AnyConnectOptions][FromStr]from_str().(url: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sqlx-core 0.8.3 any/options/impl#[AnyConnectOptions][FromStr], Selfrust-analyzer cargo sqlx-core 0.8.3 any/options/impl#[AnyConnectOptions][FromStr]::Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#Err#> { |
| 27 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(AnyConnectOptionsrust-analyzer cargo sqlx-core 0.8.3 any/options/AnyConnectOptions# { |
| 28 | database_urlrust-analyzer cargo sqlx-core 0.8.3 any/options/AnyConnectOptions#database_url.: url |
| 29 | .parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().::<Urlrust-analyzer cargo url 2.5.8 Url#>() |
| 30 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|e| Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#::Configurationrust-analyzer cargo sqlx-core 0.8.3 error/Error#Configuration#(e.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 31 | log_settingsrust-analyzer cargo sqlx-core 0.8.3 any/options/AnyConnectOptions#log_settings.: LogSettingsrust-analyzer cargo sqlx-core 0.8.3 connection/LogSettings#::defaultrust-analyzer cargo sqlx-core 0.8.3 connection/impl#[LogSettings][Default]default().(), |
| 32 | }) |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | impl ConnectOptionsrust-analyzer cargo sqlx-core 0.8.3 connection/ConnectOptions# for AnyConnectOptionsrust-analyzer cargo sqlx-core 0.8.3 any/options/AnyConnectOptions# { |
| 37 | type Connectionrust-analyzer cargo sqlx-core 0.8.3 any/options/impl#[AnyConnectOptions][ConnectOptions]Connection# = AnyConnectionrust-analyzer cargo sqlx-core 0.8.3 any/connection/AnyConnection#; |
| 38 | |
| 39 | fn from_urlrust-analyzer cargo sqlx-core 0.8.3 any/options/impl#[AnyConnectOptions][ConnectOptions]from_url().(url: &Urlrust-analyzer cargo url 2.5.8 Url#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sqlx-core 0.8.3 any/options/impl#[AnyConnectOptions][ConnectOptions], Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> { |
| 40 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(AnyConnectOptionsrust-analyzer cargo sqlx-core 0.8.3 any/options/AnyConnectOptions# { |
| 41 | database_urlrust-analyzer cargo sqlx-core 0.8.3 any/options/AnyConnectOptions#database_url.: url.clonerust-analyzer cargo url 2.5.8 impl#[Url][Clone]clone().(), |
| 42 | log_settingsrust-analyzer cargo sqlx-core 0.8.3 any/options/AnyConnectOptions#log_settings.: LogSettingsrust-analyzer cargo sqlx-core 0.8.3 connection/LogSettings#::defaultrust-analyzer cargo sqlx-core 0.8.3 connection/impl#[LogSettings][Default]default().(), |
| 43 | }) |
| 44 | } |
| 45 | |
| 46 | fn to_url_lossyrust-analyzer cargo sqlx-core 0.8.3 any/options/impl#[AnyConnectOptions][ConnectOptions]to_url_lossy().(&self) -> Urlrust-analyzer cargo url 2.5.8 Url# { |
| 47 | self.database_urlrust-analyzer cargo sqlx-core 0.8.3 any/options/AnyConnectOptions#database_url..clonerust-analyzer cargo url 2.5.8 impl#[Url][Clone]clone().() |
| 48 | } |
| 49 | |
| 50 | #[inline] |
| 51 | fn connectrust-analyzer cargo sqlx-core 0.8.3 any/options/impl#[AnyConnectOptions][ConnectOptions]connect().(&self) -> BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#<'_, Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<AnyConnectionrust-analyzer cargo sqlx-core 0.8.3 any/connection/AnyConnection#, Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>> { |
| 52 | AnyConnectionrust-analyzer cargo sqlx-core 0.8.3 any/connection/AnyConnection#::connectrust-analyzer cargo sqlx-core 0.8.3 any/connection/impl#[AnyConnection]connect().(self) |
| 53 | } |
| 54 | |
| 55 | fn log_statementsrust-analyzer cargo sqlx-core 0.8.3 any/options/impl#[AnyConnectOptions][ConnectOptions]log_statements().(mut self, level: LevelFilterrust-analyzer cargo log 0.4.34 LevelFilter#) -> Selfrust-analyzer cargo sqlx-core 0.8.3 any/options/impl#[AnyConnectOptions][ConnectOptions] { |
| 56 | self.log_settingsrust-analyzer cargo sqlx-core 0.8.3 any/options/AnyConnectOptions#log_settings..statements_levelrust-analyzer cargo sqlx-core 0.8.3 connection/LogSettings#statements_level. = level; |
| 57 | self |
| 58 | } |
| 59 | |
| 60 | fn log_slow_statementsrust-analyzer cargo sqlx-core 0.8.3 any/options/impl#[AnyConnectOptions][ConnectOptions]log_slow_statements().(mut self, level: LevelFilterrust-analyzer cargo log 0.4.34 LevelFilter#, duration: Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#) -> Selfrust-analyzer cargo sqlx-core 0.8.3 any/options/impl#[AnyConnectOptions][ConnectOptions] { |
| 61 | self.log_settingsrust-analyzer cargo sqlx-core 0.8.3 any/options/AnyConnectOptions#log_settings..slow_statements_levelrust-analyzer cargo sqlx-core 0.8.3 connection/LogSettings#slow_statements_level. = level; |
| 62 | self.log_settingsrust-analyzer cargo sqlx-core 0.8.3 any/options/AnyConnectOptions#log_settings..slow_statements_durationrust-analyzer cargo sqlx-core 0.8.3 connection/LogSettings#slow_statements_duration. = duration; |
| 63 | self |
| 64 | } |
| 65 | } |