| 1 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::errorrust-analyzer cargo sqlx-mysql 0.8.3 error/::Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#; |
| 2 | 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#; |
| 3 | |
| 4 | /// Options for controlling the desired security state of the connection to the MySQL server. |
| 5 | /// |
| 6 | /// It is used by the [`ssl_mode`](super::MySqlConnectOptions::ssl_mode) method. |
| 7 | #[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:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 8 | pub enum MySqlSslModerust-analyzer cargo sqlx-mysql 0.8.3 options/ssl_mode/MySqlSslMode# { |
| 9 | /// Establish an unencrypted connection. |
| 10 | Disabledrust-analyzer cargo sqlx-mysql 0.8.3 options/ssl_mode/MySqlSslMode#Disabled#, |
| 11 | |
| 12 | /// Establish an encrypted connection if the server supports encrypted connections, falling |
| 13 | /// back to an unencrypted connection if an encrypted connection cannot be established. |
| 14 | /// |
| 15 | /// This is the default if `ssl_mode` is not specified. |
| 16 | #[defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/default:] |
| 17 | Preferredrust-analyzer cargo sqlx-mysql 0.8.3 options/ssl_mode/MySqlSslMode#Preferred#, |
| 18 | |
| 19 | /// Establish an encrypted connection if the server supports encrypted connections. |
| 20 | /// The connection attempt fails if an encrypted connection cannot be established. |
| 21 | Requiredrust-analyzer cargo sqlx-mysql 0.8.3 options/ssl_mode/MySqlSslMode#Required#, |
| 22 | |
| 23 | /// Like `Required`, but additionally verify the server Certificate Authority (CA) |
| 24 | /// certificate against the configured CA certificates. The connection attempt fails |
| 25 | /// if no valid matching CA certificates are found. |
| 26 | VerifyCarust-analyzer cargo sqlx-mysql 0.8.3 options/ssl_mode/MySqlSslMode#VerifyCa#, |
| 27 | |
| 28 | /// Like `VerifyCa`, but additionally perform host name identity verification by |
| 29 | /// checking the host name the client uses for connecting to the server against the |
| 30 | /// identity in the certificate that the server sends to the client. |
| 31 | VerifyIdentityrust-analyzer cargo sqlx-mysql 0.8.3 options/ssl_mode/MySqlSslMode#VerifyIdentity#, |
| 32 | } |
| 33 | |
| 34 | impl FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr# for MySqlSslModerust-analyzer cargo sqlx-mysql 0.8.3 options/ssl_mode/MySqlSslMode# { |
| 35 | type Errrust-analyzer cargo sqlx-mysql 0.8.3 options/ssl_mode/impl#[MySqlSslMode][FromStr]Err# = Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#; |
| 36 | |
| 37 | fn from_strrust-analyzer cargo sqlx-mysql 0.8.3 options/ssl_mode/impl#[MySqlSslMode][FromStr]from_str().(s: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sqlx-mysql 0.8.3 options/ssl_mode/impl#[MySqlSslMode][FromStr], Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> { |
| 38 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(match &*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Deref]deref().s.to_ascii_lowercaserust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str]to_ascii_lowercase().() { |
| 39 | "disabled" => MySqlSslModerust-analyzer cargo sqlx-mysql 0.8.3 options/ssl_mode/MySqlSslMode#::Disabledrust-analyzer cargo sqlx-mysql 0.8.3 options/ssl_mode/MySqlSslMode#Disabled#, |
| 40 | "preferred" => MySqlSslModerust-analyzer cargo sqlx-mysql 0.8.3 options/ssl_mode/MySqlSslMode#::Preferredrust-analyzer cargo sqlx-mysql 0.8.3 options/ssl_mode/MySqlSslMode#Preferred#, |
| 41 | "required" => MySqlSslModerust-analyzer cargo sqlx-mysql 0.8.3 options/ssl_mode/MySqlSslMode#::Requiredrust-analyzer cargo sqlx-mysql 0.8.3 options/ssl_mode/MySqlSslMode#Required#, |
| 42 | "verify_ca" => MySqlSslModerust-analyzer cargo sqlx-mysql 0.8.3 options/ssl_mode/MySqlSslMode#::VerifyCarust-analyzer cargo sqlx-mysql 0.8.3 options/ssl_mode/MySqlSslMode#VerifyCa#, |
| 43 | "verify_identity" => MySqlSslModerust-analyzer cargo sqlx-mysql 0.8.3 options/ssl_mode/MySqlSslMode#::VerifyIdentityrust-analyzer cargo sqlx-mysql 0.8.3 options/ssl_mode/MySqlSslMode#VerifyIdentity#, |
| 44 | |
| 45 | _ => { |
| 46 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#::Configurationrust-analyzer cargo sqlx-core 0.8.3 error/Error#Configuration#( |
| 47 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("unknown value {s:?} for `ssl_mode`").intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 48 | )); |
| 49 | } |
| 50 | }) |
| 51 | } |
| 52 | } |