| 1 | 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#; |
| 2 | |
| 3 | 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#; |
| 4 | |
| 5 | #[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:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 6 | // These have all the same suffix but they match the auth plugin names. |
| 7 | #[allow(clippy::enum_variant_names)] |
| 8 | pub enum AuthPluginrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin# { |
| 9 | MySqlNativePasswordrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin#MySqlNativePassword#, |
| 10 | CachingSha2Passwordrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin#CachingSha2Password#, |
| 11 | Sha256Passwordrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin#Sha256Password#, |
| 12 | MySqlClearPasswordrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin#MySqlClearPassword#, |
| 13 | } |
| 14 | |
| 15 | impl AuthPluginrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin# { |
| 16 | pub(craterust-analyzer cargo sqlx-mysql 0.8.3 crate/) fn namerust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/impl#[AuthPlugin]name().(self) -> &'static str { |
| 17 | match self { |
| 18 | AuthPluginrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin#::MySqlNativePasswordrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin#MySqlNativePassword# => "mysql_native_password", |
| 19 | AuthPluginrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin#::CachingSha2Passwordrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin#CachingSha2Password# => "caching_sha2_password", |
| 20 | AuthPluginrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin#::Sha256Passwordrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin#Sha256Password# => "sha256_password", |
| 21 | AuthPluginrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin#::MySqlClearPasswordrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin#MySqlClearPassword# => "mysql_clear_password", |
| 22 | } |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | impl FromStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr# for AuthPluginrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin# { |
| 27 | type Errrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/impl#[AuthPlugin][FromStr]Err# = Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#; |
| 28 | |
| 29 | fn from_strrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/impl#[AuthPlugin][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 protocol/auth/impl#[AuthPlugin][FromStr], Selfrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/impl#[AuthPlugin][FromStr]::Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/traits/FromStr#Err#> { |
| 30 | match s { |
| 31 | "mysql_native_password" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(AuthPluginrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin#::MySqlNativePasswordrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin#MySqlNativePassword#), |
| 32 | "caching_sha2_password" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(AuthPluginrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin#::CachingSha2Passwordrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin#CachingSha2Password#), |
| 33 | "sha256_password" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(AuthPluginrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin#::Sha256Passwordrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin#Sha256Password#), |
| 34 | "mysql_clear_password" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(AuthPluginrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin#::MySqlClearPasswordrust-analyzer cargo sqlx-mysql 0.8.3 protocol/auth/AuthPlugin#MySqlClearPassword#), |
| 35 | |
| 36 | _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err_protocolrust-analyzer cargo sqlx-core 0.8.3 error/err_protocol!!("unknown authentication plugin: {}", s)), |
| 37 | } |
| 38 | } |
| 39 | } |