@@ -1100,18 +1100,29 @@ impl ClientOptions {
11001100 uri : impl AsRef < str > ,
11011101 resolver_config : Option < ResolverConfig > ,
11021102 ) -> Result < Self > {
1103- Self :: parse_connection_string ( ConnectionString :: parse ( uri) ?, resolver_config) . await
1103+ Self :: parse_connection_string_internal ( ConnectionString :: parse ( uri) ?, resolver_config) . await
11041104 }
11051105
11061106 /// Creates a `ClientOptions` from the given `ConnectionString`.
11071107 ///
11081108 /// In the case that "mongodb+srv" is used, SRV and TXT record lookups will be done using the
11091109 /// provided `ResolverConfig` as part of this method.
1110- pub async fn parse_connection_string (
1110+ pub async fn parse_connection_string_with_resolver_config (
1111+ conn_str : ConnectionString ,
1112+ resolver_config : ResolverConfig ,
1113+ ) -> Result < Self > {
1114+ Self :: parse_connection_string_internal ( conn_str, Some ( resolver_config) ) . await
1115+ }
1116+
1117+ /// Creates a `ClientOptions` from the given `ConnectionString`.
1118+ pub async fn parse_connection_string ( conn_str : ConnectionString ) -> Result < Self > {
1119+ Self :: parse_connection_string_internal ( conn_str, None ) . await
1120+ }
1121+
1122+ async fn parse_connection_string_internal (
11111123 mut conn_str : ConnectionString ,
1112- resolver_config : impl Into < Option < ResolverConfig > > ,
1124+ resolver_config : Option < ResolverConfig > ,
11131125 ) -> Result < Self > {
1114- let resolver_config = resolver_config. into ( ) ;
11151126 let auth_source_present = conn_str
11161127 . credential
11171128 . as_ref ( )
@@ -1172,16 +1183,25 @@ impl ClientOptions {
11721183 Ok ( options)
11731184 }
11741185
1186+ /// Creates a `ClientOptions` from the given `ConnectionString`.
1187+ #[ cfg( any( feature = "sync" , feature = "tokio-sync" ) ) ]
1188+ pub fn parse_connection_string_sync ( conn_str : ConnectionString ) -> Result < Self > {
1189+ crate :: runtime:: block_on ( Self :: parse_connection_string_internal ( conn_str, None ) )
1190+ }
1191+
11751192 /// Creates a `ClientOptions` from the given `ConnectionString`.
11761193 ///
11771194 /// In the case that "mongodb+srv" is used, SRV and TXT record lookups will be done using the
11781195 /// provided `ResolverConfig` as part of this method.
11791196 #[ cfg( any( feature = "sync" , feature = "tokio-sync" ) ) ]
1180- pub fn parse_connection_string_sync (
1197+ pub fn parse_connection_string_with_resolver_config_sync (
11811198 conn_str : ConnectionString ,
1182- resolver_config : impl Into < Option < ResolverConfig > > ,
1199+ resolver_config : ResolverConfig ,
11831200 ) -> Result < Self > {
1184- crate :: runtime:: block_on ( Self :: parse_connection_string ( conn_str, resolver_config) )
1201+ crate :: runtime:: block_on ( Self :: parse_connection_string_internal (
1202+ conn_str,
1203+ Some ( resolver_config) ,
1204+ ) )
11851205 }
11861206
11871207 fn from_connection_string ( conn_str : ConnectionString ) -> Self {
0 commit comments