From 04b8729d6baf411847ec89d29b97848781a96dbb Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 12 May 2022 10:09:46 +0100 Subject: [PATCH] Add correct serde(default) attrs for humantime_serde::option Discovered by a test case in my local tree. The test case was macro-generated by an extension of impl_standard_builder (which macro istself currently awaiting review, arti!499) Have also sent an MR to update the upstream docs https://github.com/jean-airoldie/humantime-serde/pull/8 --- crates/arti-client/src/config.rs | 6 +++--- crates/tor-circmgr/src/config.rs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/arti-client/src/config.rs b/crates/arti-client/src/config.rs index 3a27a01b2..5e9060f57 100644 --- a/crates/arti-client/src/config.rs +++ b/crates/arti-client/src/config.rs @@ -73,18 +73,18 @@ pub struct StreamTimeoutConfig { /// How long should we wait before timing out a stream when connecting /// to a host? #[builder(default = "default_connect_timeout()")] - #[builder_field_attr(serde(with = "humantime_serde::option"))] + #[builder_field_attr(serde(default, with = "humantime_serde::option"))] pub(crate) connect_timeout: Duration, /// How long should we wait before timing out when resolving a DNS record? #[builder(default = "default_dns_resolve_timeout()")] - #[builder_field_attr(serde(with = "humantime_serde::option"))] + #[builder_field_attr(serde(default, with = "humantime_serde::option"))] pub(crate) resolve_timeout: Duration, /// How long should we wait before timing out when resolving a DNS /// PTR record? #[builder(default = "default_dns_resolve_ptr_timeout()")] - #[builder_field_attr(serde(with = "humantime_serde::option"))] + #[builder_field_attr(serde(default, with = "humantime_serde::option"))] pub(crate) resolve_ptr_timeout: Duration, } diff --git a/crates/tor-circmgr/src/config.rs b/crates/tor-circmgr/src/config.rs index f36c5e29e..610f3ff36 100644 --- a/crates/tor-circmgr/src/config.rs +++ b/crates/tor-circmgr/src/config.rs @@ -117,7 +117,7 @@ pub struct PreemptiveCircuitConfig { /// should we predict that the client will still want to have circuits /// available for that port? #[builder(default = "default_preemptive_duration()")] - #[builder_field_attr(serde(with = "humantime_serde::option"))] + #[builder_field_attr(serde(default, with = "humantime_serde::option"))] pub(crate) prediction_lifetime: Duration, /// How many available circuits should we try to have, at minimum, for each @@ -143,14 +143,14 @@ pub struct CircuitTiming { /// How long after a circuit has first been used should we give /// it out for new requests? #[builder(default = "default_max_dirtiness()")] - #[builder_field_attr(serde(with = "humantime_serde::option"))] + #[builder_field_attr(serde(default, with = "humantime_serde::option"))] pub(crate) max_dirtiness: Duration, /// When a circuit is requested, we stop retrying new circuits /// after this much time. // TODO: Impose a maximum or minimum? #[builder(default = "default_request_timeout()")] - #[builder_field_attr(serde(with = "humantime_serde::option"))] + #[builder_field_attr(serde(default, with = "humantime_serde::option"))] pub(crate) request_timeout: Duration, /// When a circuit is requested, we stop retrying new circuits after @@ -163,7 +163,7 @@ pub struct CircuitTiming { /// before using a suitable-looking circuit launched by some other /// request. #[builder(default = "default_request_loyalty()")] - #[builder_field_attr(serde(with = "humantime_serde::option"))] + #[builder_field_attr(serde(default, with = "humantime_serde::option"))] pub(crate) request_loyalty: Duration, }