Debian Codegraph @

src/options/ssl_mode.rs

raw symbols SCIP
1 use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::errorrust-analyzer cargo sqlx-postgres 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 level of protection provided for PostgreSQL SSL connections.
5 ///
6 /// It is used by the [`ssl_mode`](super::PgConnectOptions::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 PgSslModerust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/PgSslMode# {
9 /// Only try a non-SSL connection.
10 Disablerust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/PgSslMode#Disable#,
11
12 /// First try a non-SSL connection; if that fails, try an SSL connection.
13 Allowrust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/PgSslMode#Allow#,
14
15 /// First try an SSL connection; if that fails, try a non-SSL connection.
16 ///
17 /// This is the default if no other mode is specified.
18 #[defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/default:]
19 Preferrust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/PgSslMode#Prefer#,
20
21 /// Only try an SSL connection. If a root CA file is present, verify the connection
22 /// in the same way as if `VerifyCa` was specified.
23 Requirerust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/PgSslMode#Require#,
24
25 /// Only try an SSL connection, and verify that the server certificate is issued by a
26 /// trusted certificate authority (CA).
27 VerifyCarust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/PgSslMode#VerifyCa#,
28
29 /// Only try an SSL connection; verify that the server certificate is issued by a trusted
30 /// CA and that the requested server host name matches that in the certificate.
31 VerifyFullrust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/PgSslMode#VerifyFull#,
32 }
33
34 impl FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr# for PgSslModerust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/PgSslMode# {
35 type Errrust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/impl#[PgSslMode][FromStr]Err# = Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#;
36
37 fn from_strrust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/impl#[PgSslMode][FromStr]from_str().(s: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/impl#[PgSslMode][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 "disable" => PgSslModerust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/PgSslMode#::Disablerust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/PgSslMode#Disable#,
40 "allow" => PgSslModerust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/PgSslMode#::Allowrust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/PgSslMode#Allow#,
41 "prefer" => PgSslModerust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/PgSslMode#::Preferrust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/PgSslMode#Prefer#,
42 "require" => PgSslModerust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/PgSslMode#::Requirerust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/PgSslMode#Require#,
43 "verify-ca" => PgSslModerust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/PgSslMode#::VerifyCarust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/PgSslMode#VerifyCa#,
44 "verify-full" => PgSslModerust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/PgSslMode#::VerifyFullrust-analyzer cargo sqlx-postgres 0.8.3 options/ssl_mode/PgSslMode#VerifyFull#,
45
46 _ => {
47 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#(
48 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().(),
49 ));
50 }
51 })
52 }
53 }