/// Validates that a `saslStart` or `saslContinue` command response is successful.
Validates that a `saslStart` or `saslContinue` command response is successful.
Validates that a ` saslStart ` or ` saslContinue ` command response is successful .
fn validate_command_success(auth_mechanism: &str, response: &Document) -> Result<()> {
    let ok = match response.get("ok") {
        Some(ok) => ok,
        None => return Ok(()),
    };
    match bson_util::get_int(ok) {
        Some(1) => Ok(()),
        Some(_) => Err(Error::authentication_error(
            auth_mechanism,
            response
                .get_str("errmsg")
                .unwrap_or("Authentication failure"),
        )),
        _ => Err(Error::invalid_authentication_response(auth_mechanism)),
    }
}
fn validate_command_success ( auth_mechanism : & str , response : & Document ) -> Result < ( ) > { let ok = match response . get ( " " ) { Some ( ok ) => ok , None => return Ok ( ( ) ) , } ; match bson_util :: get_int ( ok ) { Some ( 1 ) => Ok ( ( ) ) , Some ( _ ) => Err ( Error :: authentication_error ( auth_mechanism , response . get_str ( " " ) . unwrap_or ( " " ) , ) ) , _ => Err ( Error :: invalid_authentication_response ( auth_mechanism ) ) , } }
Validates that a `saslStart` or `saslContinue` command response is successful.
Validates that a ` saslStart ` or ` saslContinue ` command response is successful .
auth_mechanism
&str
response
&Document