Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ mod rowbinary;
mod ticks;

/// A client containing HTTP pool.
///
/// ### Cloning behavior
/// Clones share the same HTTP transport but store their own configurations.
/// Any `with_*` configuration method (e.g., [`Client::with_option`]) applies
/// only to future clones, because [`Client::clone`] creates a deep copy
/// of the [`Client`] configuration, except the transport.
#[derive(Clone)]
pub struct Client {
http: Arc<dyn HttpClient>,
Expand Down Expand Up @@ -518,4 +524,18 @@ mod client_tests {
let client = client.with_validation(true);
assert!(client.validation);
}

#[test]
fn it_does_follow_previous_configuration() {
let client = Client::default().with_option("async_insert", "1");
assert_eq!(client.options, client.clone().options,);
}

#[test]
fn it_does_not_follow_future_configuration() {
let client = Client::default();
let client_clone = client.clone();
let client = client.with_option("async_insert", "1");
assert_ne!(client.options, client_clone.options,);
}
}
Loading