mysql_binlog_connector_rust/command/
auth_plugin.rs

1use core::str;
2
3#[derive(PartialEq, Clone)]
4pub enum AuthPlugin {
5    Unsupported,
6    MySqlNativePassword,
7    CachingSha2Password,
8}
9
10impl AuthPlugin {
11    pub fn to_str(&self) -> &str {
12        match self {
13            AuthPlugin::MySqlNativePassword => "mysql_native_password",
14            AuthPlugin::CachingSha2Password => "caching_sha2_password",
15            _ => "unsupported",
16        }
17    }
18
19    pub fn from_name(name: &str) -> Self {
20        match name.to_lowercase().as_str() {
21            "mysql_native_password" => AuthPlugin::MySqlNativePassword,
22            "caching_sha2_password" => AuthPlugin::CachingSha2Password,
23            _ => AuthPlugin::Unsupported,
24        }
25    }
26}