@@ -334,30 +334,29 @@ impl<'de> Deserialize<'de> for ServerApiVersion {
334
334
/// https://www.mongodb.com/docs/v5.0/reference/stable-api/) manual page.
335
335
#[ serde_with:: skip_serializing_none]
336
336
#[ derive( Clone , Debug , Deserialize , Serialize , PartialEq , TypedBuilder ) ]
337
- #[ builder( field_defaults( setter( into) ) ) ]
337
+ #[ builder( field_defaults( default , setter( into) ) ) ]
338
338
#[ non_exhaustive]
339
339
pub struct ServerApi {
340
340
/// The declared API version.
341
341
#[ serde( rename = "apiVersion" ) ]
342
+ #[ builder( !default ) ]
342
343
pub version : ServerApiVersion ,
343
344
344
345
/// Whether the MongoDB server should reject all commands that are not part of the
345
346
/// declared API version. This includes command options and aggregation pipeline stages.
346
- #[ builder( default ) ]
347
347
#[ serde( rename = "apiStrict" ) ]
348
348
pub strict : Option < bool > ,
349
349
350
350
/// Whether the MongoDB server should return command failures when functionality that is
351
351
/// deprecated from the declared API version is used.
352
352
/// Note that at the time of this writing, no deprecations in version 1 exist.
353
- #[ builder( default ) ]
354
353
#[ serde( rename = "apiDeprecationErrors" ) ]
355
354
pub deprecation_errors : Option < bool > ,
356
355
}
357
356
358
357
/// Contains the options that can be used to create a new [`Client`](../struct.Client.html).
359
358
#[ derive( Clone , Derivative , Deserialize , TypedBuilder ) ]
360
- #[ builder( field_defaults( setter( into) ) ) ]
359
+ #[ builder( field_defaults( default , setter( into) ) ) ]
361
360
#[ derivative( Debug , PartialEq ) ]
362
361
#[ serde( rename_all = "camelCase" ) ]
363
362
#[ non_exhaustive]
@@ -377,7 +376,6 @@ pub struct ClientOptions {
377
376
/// The application name that the Client will send to the server as part of the handshake. This
378
377
/// can be used in combination with the server logs to determine which Client is connected to a
379
378
/// server.
380
- #[ builder( default ) ]
381
379
pub app_name : Option < String > ,
382
380
383
381
/// The allowed compressors to use to compress messages sent to and decompress messages
@@ -389,55 +387,49 @@ pub struct ClientOptions {
389
387
feature = "zlib-compression" ,
390
388
feature = "snappy-compression"
391
389
) ) ]
392
- #[ builder( default ) ]
393
390
#[ serde( skip) ]
394
391
pub compressors : Option < Vec < Compressor > > ,
395
392
396
393
/// The handler that should process all Connection Monitoring and Pooling events.
397
394
#[ derivative( Debug = "ignore" , PartialEq = "ignore" ) ]
398
- #[ builder( default , setter( strip_option) ) ]
395
+ #[ builder( setter( strip_option) ) ]
399
396
#[ serde( skip) ]
400
397
pub cmap_event_handler : Option < EventHandler < crate :: event:: cmap:: CmapEvent > > ,
401
398
402
399
/// The handler that should process all command-related events.
403
400
///
404
401
/// Note that monitoring command events may incur a performance penalty.
405
402
#[ derivative( Debug = "ignore" , PartialEq = "ignore" ) ]
406
- #[ builder( default , setter( strip_option) ) ]
403
+ #[ builder( setter( strip_option) ) ]
407
404
#[ serde( skip) ]
408
405
pub command_event_handler : Option < EventHandler < crate :: event:: command:: CommandEvent > > ,
409
406
410
407
/// The connect timeout passed to each underlying TcpStream when attemtping to connect to the
411
408
/// server.
412
409
///
413
410
/// The default value is 10 seconds.
414
- #[ builder( default ) ]
415
411
pub connect_timeout : Option < Duration > ,
416
412
417
413
/// The credential to use for authenticating connections made by this client.
418
- #[ builder( default ) ]
419
414
pub credential : Option < Credential > ,
420
415
421
416
/// Specifies whether the Client should directly connect to a single host rather than
422
417
/// autodiscover all servers in the cluster.
423
418
///
424
419
/// The default value is false.
425
- #[ builder( default ) ]
426
420
pub direct_connection : Option < bool > ,
427
421
428
422
/// Extra information to append to the driver version in the metadata of the handshake with the
429
423
/// server. This should be used by libraries wrapping the driver, e.g. ODMs.
430
- #[ builder( default ) ]
431
424
pub driver_info : Option < DriverInfo > ,
432
425
433
426
/// The amount of time each monitoring thread should wait between performing server checks.
434
427
///
435
428
/// The default value is 10 seconds.
436
- #[ builder( default ) ]
437
429
pub heartbeat_freq : Option < Duration > ,
438
430
439
431
/// Whether or not the client is connecting to a MongoDB cluster through a load balancer.
440
- #[ builder( default , setter( skip) ) ]
432
+ #[ builder( setter( skip) ) ]
441
433
#[ serde( rename = "loadbalanced" ) ]
442
434
pub load_balanced : Option < bool > ,
443
435
@@ -452,14 +444,12 @@ pub struct ClientOptions {
452
444
/// lowest average round trip time is eligible.
453
445
///
454
446
/// The default value is 15 ms.
455
- #[ builder( default ) ]
456
447
pub local_threshold : Option < Duration > ,
457
448
458
449
/// The amount of time that a connection can remain idle in a connection pool before being
459
450
/// closed. A value of zero indicates that connections should not be closed due to being idle.
460
451
///
461
452
/// By default, connections will not be closed due to being idle.
462
- #[ builder( default ) ]
463
453
pub max_idle_time : Option < Duration > ,
464
454
465
455
/// The maximum amount of connections that the Client should allow to be created in a
@@ -468,59 +458,50 @@ pub struct ClientOptions {
468
458
/// operation finishes and its connection is checked back into the pool.
469
459
///
470
460
/// The default value is 10.
471
- #[ builder( default ) ]
472
461
pub max_pool_size : Option < u32 > ,
473
462
474
463
/// The minimum number of connections that should be available in a server's connection pool at
475
464
/// a given time. If fewer than `min_pool_size` connections are in the pool, connections will
476
465
/// be added to the pool in the background until `min_pool_size` is reached.
477
466
///
478
467
/// The default value is 0.
479
- #[ builder( default ) ]
480
468
pub min_pool_size : Option < u32 > ,
481
469
482
470
/// The maximum number of new connections that can be created concurrently.
483
471
///
484
472
/// If specified, this value must be greater than 0. The default is 2.
485
- #[ builder( default ) ]
486
473
pub max_connecting : Option < u32 > ,
487
474
488
475
/// Specifies the default read concern for operations performed on the Client. See the
489
476
/// ReadConcern type documentation for more details.
490
- #[ builder( default ) ]
491
477
pub read_concern : Option < ReadConcern > ,
492
478
493
479
/// The name of the replica set that the Client should connect to.
494
- #[ builder( default ) ]
495
480
pub repl_set_name : Option < String > ,
496
481
497
482
/// Whether or not the client should retry a read operation if the operation fails.
498
483
///
499
484
/// The default value is true.
500
- #[ builder( default ) ]
501
485
pub retry_reads : Option < bool > ,
502
486
503
487
/// Whether or not the client should retry a write operation if the operation fails.
504
488
///
505
489
/// The default value is true.
506
- #[ builder( default ) ]
507
490
pub retry_writes : Option < bool > ,
508
491
509
492
/// Configures which server monitoring protocol to use.
510
493
///
511
494
/// The default is [`Auto`](ServerMonitoringMode::Auto).
512
- #[ builder( default ) ]
513
495
pub server_monitoring_mode : Option < ServerMonitoringMode > ,
514
496
515
497
/// The handler that should process all Server Discovery and Monitoring events.
516
498
#[ derivative( Debug = "ignore" , PartialEq = "ignore" ) ]
517
- #[ builder( default , setter( strip_option) ) ]
499
+ #[ builder( setter( strip_option) ) ]
518
500
#[ serde( skip) ]
519
501
pub sdam_event_handler : Option < EventHandler < crate :: event:: sdam:: SdamEvent > > ,
520
502
521
503
/// The default selection criteria for operations performed on the Client. See the
522
504
/// SelectionCriteria type documentation for more details.
523
- #[ builder( default ) ]
524
505
pub selection_criteria : Option < SelectionCriteria > ,
525
506
526
507
/// The declared API version for this client.
@@ -534,30 +515,26 @@ pub struct ClientOptions {
534
515
///
535
516
/// For more information, see the [Stable API](
536
517
/// https://www.mongodb.com/docs/v5.0/reference/stable-api/) manual page.
537
- #[ builder( default ) ]
538
518
pub server_api : Option < ServerApi > ,
539
519
540
520
/// The amount of time the Client should attempt to select a server for an operation before
541
521
/// timing outs
542
522
///
543
523
/// The default value is 30 seconds.
544
- #[ builder( default ) ]
545
524
pub server_selection_timeout : Option < Duration > ,
546
525
547
526
/// Default database for this client.
548
527
///
549
528
/// By default, no default database is specified.
550
- #[ builder( default ) ]
551
529
pub default_database : Option < String > ,
552
530
553
- #[ builder( default , setter( skip) ) ]
531
+ #[ builder( setter( skip) ) ]
554
532
#[ derivative( Debug = "ignore" ) ]
555
533
pub ( crate ) socket_timeout : Option < Duration > ,
556
534
557
535
/// The TLS configuration for the Client to use in its connections with the server.
558
536
///
559
537
/// By default, TLS is disabled.
560
- #[ builder( default ) ]
561
538
pub tls : Option < Tls > ,
562
539
563
540
/// The maximum number of bytes that the driver should include in a tracing event
@@ -570,26 +547,23 @@ pub struct ClientOptions {
570
547
///
571
548
/// The default value is 1000.
572
549
#[ cfg( feature = "tracing-unstable" ) ]
573
- #[ builder( default ) ]
574
550
pub tracing_max_document_length_bytes : Option < usize > ,
575
551
576
552
/// Specifies the default write concern for operations performed on the Client. See the
577
553
/// WriteConcern type documentation for more details.
578
- #[ builder( default ) ]
579
554
pub write_concern : Option < WriteConcern > ,
580
555
581
556
/// Limit on the number of mongos connections that may be created for sharded topologies.
582
- #[ builder( default ) ]
583
557
pub srv_max_hosts : Option < u32 > ,
584
558
585
559
/// Information from the SRV URI that generated these client options, if applicable.
586
- #[ builder( default , setter( skip) ) ]
560
+ #[ builder( setter( skip) ) ]
587
561
#[ serde( skip) ]
588
562
#[ derivative( Debug = "ignore" ) ]
589
563
pub ( crate ) original_srv_info : Option < OriginalSrvInfo > ,
590
564
591
565
#[ cfg( test) ]
592
- #[ builder( default , setter( skip) ) ]
566
+ #[ builder( setter( skip) ) ]
593
567
#[ derivative( Debug = "ignore" ) ]
594
568
pub ( crate ) original_uri : Option < String > ,
595
569
@@ -598,15 +572,15 @@ pub struct ClientOptions {
598
572
///
599
573
/// On Windows, there is a known performance issue in trust-dns with using the default system
600
574
/// configuration, so a custom configuration is recommended.
601
- #[ builder( default , setter( skip) ) ]
575
+ #[ builder( setter( skip) ) ]
602
576
#[ serde( skip) ]
603
577
#[ derivative( Debug = "ignore" ) ]
604
578
#[ cfg( feature = "dns-resolver" ) ]
605
579
pub ( crate ) resolver_config : Option < ResolverConfig > ,
606
580
607
581
/// Control test behavior of the client.
608
582
#[ cfg( test) ]
609
- #[ builder( default , setter( skip) ) ]
583
+ #[ builder( setter( skip) ) ]
610
584
#[ serde( skip) ]
611
585
#[ derivative( PartialEq = "ignore" ) ]
612
586
pub ( crate ) test_options : Option < TestOptions > ,
@@ -1061,18 +1035,17 @@ impl TlsOptions {
1061
1035
/// Extra information to append to the driver version in the metadata of the handshake with the
1062
1036
/// server. This should be used by libraries wrapping the driver, e.g. ODMs.
1063
1037
#[ derive( Clone , Debug , Deserialize , TypedBuilder , PartialEq ) ]
1064
- #[ builder( field_defaults( setter( into) ) ) ]
1038
+ #[ builder( field_defaults( default , setter( into) ) ) ]
1065
1039
#[ non_exhaustive]
1066
1040
pub struct DriverInfo {
1067
1041
/// The name of the library wrapping the driver.
1042
+ #[ builder( !default ) ]
1068
1043
pub name : String ,
1069
1044
1070
1045
/// The version of the library wrapping the driver.
1071
- #[ builder( default ) ]
1072
1046
pub version : Option < String > ,
1073
1047
1074
1048
/// Optional platform information for the wrapping driver.
1075
- #[ builder( default ) ]
1076
1049
pub platform : Option < String > ,
1077
1050
}
1078
1051
0 commit comments