File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,12 @@ mod rowbinary;
3737mod ticks;
3838
3939/// A client containing HTTP pool.
40+ ///
41+ /// ### Cloning behavior
42+ /// Clones share the same HTTP transport but store their own configurations.
43+ /// Any `with_*` configuration method (e.g., [`Client::with_option`]) applies
44+ /// only to future clones, because [`Client::clone`] creates a deep copy
45+ /// of the [`Client`] configuration, except the transport.
4046#[ derive( Clone ) ]
4147pub struct Client {
4248 http : Arc < dyn HttpClient > ,
@@ -518,4 +524,18 @@ mod client_tests {
518524 let client = client. with_validation ( true ) ;
519525 assert ! ( client. validation) ;
520526 }
527+
528+ #[ test]
529+ fn it_does_follow_previous_configuration ( ) {
530+ let client = Client :: default ( ) . with_option ( "async_insert" , "1" ) ;
531+ assert_eq ! ( client. options, client. clone( ) . options, ) ;
532+ }
533+
534+ #[ test]
535+ fn it_does_not_follow_future_configuration ( ) {
536+ let client = Client :: default ( ) ;
537+ let client_clone = client. clone ( ) ;
538+ let client = client. with_option ( "async_insert" , "1" ) ;
539+ assert_ne ! ( client. options, client_clone. options, ) ;
540+ }
521541}
You can’t perform that action at this time.
0 commit comments