Skip to content

Commit

Permalink
Make Duration::not_zero public.
Browse files Browse the repository at this point in the history
This is useful for downstream wanting to re-implement `TcpTransport`
This struct is only ever exposed through the `unversionned` module
so its fine to expose this method and remove it in the future
  • Loading branch information
sosthene-nitrokey authored and algesten committed Feb 3, 2025
1 parent 414c515 commit c7a9c9e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/timings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,10 @@ pub struct NextTimeout {
}

impl NextTimeout {
pub(crate) fn not_zero(&self) -> Option<Duration> {
/// Returns the duration of the timeout if the timeout must happen, but avoid instant timeouts
///
/// If the timeout must happen but is zero, returns 1 second
pub fn not_zero(&self) -> Option<Duration> {
if self.after.is_not_happening() {
None
} else if self.after.is_zero() {
Expand Down

0 comments on commit c7a9c9e

Please sign in to comment.