Skip to main content

is_within_cooldown

Function is_within_cooldown 

Source
pub const fn is_within_cooldown(age_secs: u64, cooldown_secs: u64) -> bool
Expand description

Whether an age (in seconds) falls within a cooldown window (in seconds).

The bound is exclusive: age_secs < cooldown_secs. A version published exactly cooldown_secs ago is not within cooldown; one published a second earlier is. This is the single rule applied uniformly across hover, diagnostics, and completion — no ecosystem overrides it.

Note the parameter order: age first, cooldown second — both are plain u64, so a swapped call site would compile silently.

§Examples

use deps_core::is_within_cooldown;

assert!(is_within_cooldown(100, 200));
assert!(!is_within_cooldown(200, 200));
assert!(is_within_cooldown(199, 200));