Skip to main content

decode_instant_from_duration

Function decode_instant_from_duration 

Source
pub fn decode_instant_from_duration(duration: Duration) -> Instant
Available on crate feature std only.
Expand description

Decode an Instant from a Duration.

Accepts non-canonical input without panicking. If the encoded Duration is so large that instant_now + delta would overflow Instant’s internal representation, the result saturates at instant_now rather than panicking. This is important because the function sits on the serde deserialization path — a malformed or adversarial encoded value must not crash the process.