From 53e49156d6da3d85cd12e64d5477dc5b6207bd5e Mon Sep 17 00:00:00 2001 From: Dom Date: Tue, 5 Oct 2021 15:42:44 +0200 Subject: [PATCH] refactor: derive Clone for IOx client builder Allows an IOx client builder (with its associated configuration) to be cloned. --- client_util/src/connection.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/client_util/src/connection.rs b/client_util/src/connection.rs index 1729ee5e7f..15a91741f9 100644 --- a/client_util/src/connection.rs +++ b/client_util/src/connection.rs @@ -68,7 +68,7 @@ pub type Result = std::result::Result; /// .expect("connection must succeed"); /// # } /// ``` -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct Builder { user_agent: String, headers: Vec<(HeaderName, HeaderValue)>, @@ -171,3 +171,15 @@ impl Builder { Self { timeout, ..self } } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_builder_cloneable() { + // Clone is used by Conductor. + fn assert_clone(_t: T) {} + assert_clone(Builder::default()) + } +}