Skip to content

Commit ffae5c3

Browse files
authored
minor: hide versioned API from the driver's public API (#284)
1 parent 64e00e8 commit ffae5c3

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

src/client/options/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ impl fmt::Display for StreamAddress {
209209
/// Specifies the server API version to declare
210210
#[derive(Clone, Debug, PartialEq)]
211211
#[non_exhaustive]
212-
pub enum ServerApiVersion {
212+
pub(crate) enum ServerApiVersion {
213213
Version1,
214214
}
215215

@@ -251,7 +251,7 @@ impl<'de> Deserialize<'de> for ServerApiVersion {
251251
#[derive(Clone, Debug, Deserialize, PartialEq, TypedBuilder)]
252252
#[serde(rename_all = "camelCase")]
253253
#[non_exhaustive]
254-
pub struct ServerApi {
254+
pub(crate) struct ServerApi {
255255
/// The version string of the declared API version
256256
pub version: ServerApiVersion,
257257

@@ -402,8 +402,8 @@ pub struct ClientOptions {
402402
/// The declared API version
403403
///
404404
/// The default value is to have no declared API version
405-
#[builder(default)]
406-
pub server_api: Option<ServerApi>,
405+
#[builder(default, skip)]
406+
pub(crate) server_api: Option<ServerApi>,
407407

408408
/// The amount of time the Client should attempt to select a server for an operation before
409409
/// timing outs

src/cmap/options.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ pub struct ConnectionPoolOptions {
8585
/// The declared API version
8686
///
8787
/// The default value is to have no declared API version
88-
#[builder(default)]
89-
pub server_api: Option<ServerApi>,
88+
#[builder(skip, default)]
89+
pub(crate) server_api: Option<ServerApi>,
9090

9191
/// The options specifying how a TLS connection should be configured. If `tls_options` is
9292
/// `None`, then TLS will not be used for the connections.
@@ -118,7 +118,6 @@ impl ConnectionPoolOptions {
118118
.max_idle_time(options.max_idle_time)
119119
.max_pool_size(options.max_pool_size)
120120
.min_pool_size(options.min_pool_size)
121-
.server_api(options.server_api.clone())
122121
.tls_options(options.tls_options())
123122
.wait_queue_timeout(options.wait_queue_timeout)
124123
.build()

src/test/spec/unified_runner/test_file.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ pub struct Client {
130130
pub observe_events: Option<Vec<String>>,
131131
pub ignore_command_monitoring_events: Option<Vec<String>>,
132132
#[serde(default)]
133-
pub server_api: Option<ServerApi>,
133+
pub(crate) server_api: Option<ServerApi>,
134134
}
135135

136136
fn default_uri() -> String {

src/test/util/event.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ impl EventClient {
243243
EventClient::with_options_and_handler(options, event_handler, collect_server_info).await
244244
}
245245

246-
pub async fn with_uri_and_mongos_options(
246+
pub(crate) async fn with_uri_and_mongos_options(
247247
uri: &str,
248248
use_multiple_mongoses: Option<bool>,
249249
server_api: Option<ServerApi>,

0 commit comments

Comments
 (0)