pub fn credentials_from_data(
    passphrase: String,
    identity: Option<String>,
    mode: Security,
) -> Result<AccessPointCredentials, CaptivePortalError> {
    match mode {
        Security::ENTERPRISE => Ok(AccessPointCredentials::Enterprise {
            identity: identity.ok_or(CaptivePortalError::NoSharedKeyProvided)?,
            passphrase,
        }),
        Security::WPA | Security::WPA2 => Ok(AccessPointCredentials::Wpa { passphrase }),
        Security::WEP => Ok(AccessPointCredentials::Wep { passphrase }),
        Security::NONE => Ok(AccessPointCredentials::None),
    }
}
/// Converts a set of credentials into the [`AccessPointCredentials`] type.
Converts a set of credentials into the [`AccessPointCredentials`] type.
Converts a set of credentials into the [ ` AccessPointCredentials ` ] type .
pub fn credentials_from_data(
    passphrase: String,
    identity: Option<String>,
    mode: Security,
) -> Result<AccessPointCredentials, CaptivePortalError> {
    match mode {
        Security::ENTERPRISE => Ok(AccessPointCredentials::Enterprise {
            identity: identity.ok_or(CaptivePortalError::NoSharedKeyProvided)?,
            passphrase,
        }),
        Security::WPA | Security::WPA2 => Ok(AccessPointCredentials::Wpa { passphrase }),
        Security::WEP => Ok(AccessPointCredentials::Wep { passphrase }),
        Security::NONE => Ok(AccessPointCredentials::None),
    }
}
pub fn credentials_from_data ( passphrase : String , identity : Option < String > , mode : Security , ) -> Result < AccessPointCredentials , CaptivePortalError > { match mode { Security :: ENTERPRISE => Ok ( AccessPointCredentials :: Enterprise { identity : identity . ok_or ( CaptivePortalError :: NoSharedKeyProvided ) ? , passphrase , } ) , Security :: WPA | Security :: WPA2 => Ok ( AccessPointCredentials :: Wpa { passphrase } ) , Security :: WEP => Ok ( AccessPointCredentials :: Wep { passphrase } ) , Security :: NONE => Ok ( AccessPointCredentials :: None ) , } }
Converts a set of credentials into the [`AccessPointCredentials`] type.
Converts a set of credentials into the [ ` AccessPointCredentials ` ] type .
passphrase
String
identity
Option<String>
mode
Security
passphrase
String
identity
Option<String>
mode
Security