From 4250d9843133d38c7ace1a1b510265a15ebaa0fd Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 30 Oct 2026 15:10:29 +0100 Subject: add dormant-probe-max option --- src/units.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/units.rs') diff --git a/src/units.rs b/src/units.rs index ac08ebf..28adab9 100644 --- a/src/units.rs +++ b/src/units.rs @@ -171,6 +171,17 @@ pub(crate) fn optional_duration<'de, D: serde::Deserializer<'de>>( duration_option::deserialize(d).map(Some) } +/// Writes an optional `Duration` as [`duration_option`] does; `None` as null. +pub(crate) fn serialize_optional_duration( + value: &Option, + s: S, +) -> Result { + match value { + Some(value) => duration_option::serialize(value, s), + None => s.serialize_none(), + } +} + /// Serde for a size option: a string as [`parse_size`] reads it, or a number of bytes; /// written as [`format_size`]. pub(crate) mod size_option { -- cgit v1.3.1