Skip to content

Commit a1a1a75

Browse files
RUST-1308 Implement Display and Serialize for ConnectionString (#1494)
1 parent de1853d commit a1a1a75

File tree

4 files changed

+412
-24
lines changed

4 files changed

+412
-24
lines changed

src/client/auth.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::{bson::RawDocumentBuf, bson_compat::cstr, options::ClientOptions};
1919
use derive_where::derive_where;
2020
use hmac::{digest::KeyInit, Mac};
2121
use rand::Rng;
22-
use serde::Deserialize;
22+
use serde::{Deserialize, Serialize};
2323
use typed_builder::TypedBuilder;
2424

2525
use self::scram::ScramVersion;
@@ -44,7 +44,7 @@ const MONGODB_OIDC_STR: &str = "MONGODB-OIDC";
4444
/// The authentication mechanisms supported by MongoDB.
4545
///
4646
/// Note: not all of these mechanisms are currently supported by the driver.
47-
#[derive(Clone, Deserialize, PartialEq, Debug)]
47+
#[derive(Clone, Deserialize, Serialize, PartialEq, Debug)]
4848
#[non_exhaustive]
4949
pub enum AuthMechanism {
5050
/// MongoDB Challenge Response nonce and MD5 based authentication system. It is currently
@@ -558,8 +558,7 @@ impl Credential {
558558
mechanism.authenticate_stream(conn, self, opts).await
559559
}
560560

561-
#[cfg(test)]
562-
pub(crate) fn serialize_for_client_options<S>(
561+
pub(crate) fn serialize<S>(
563562
credential: &Option<Credential>,
564563
serializer: S,
565564
) -> std::result::Result<S::Ok, S::Error>

0 commit comments

Comments
 (0)