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
This commit is contained in:
Ian Jackson 2022-05-12 10:09:46 +01:00
parent b137be222b
commit 04b8729d6b
2 changed files with 7 additions and 7 deletions

View File

@ -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,
}

View File

@ -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,
}