pub(crate) trait TokenBucketInstant:
Copy
+ Clone
+ Debug
+ PartialEq
+ Eq
+ PartialOrd
+ Ord {
const IGNORE_THRESHOLD: Duration;
// Required methods
fn checked_add(&self, duration: Duration) -> Option<Self>;
fn checked_duration_since(&self, earlier: Self) -> Option<Duration>;
// Provided method
fn saturating_duration_since(&self, earlier: Self) -> Duration { ... }
}Expand description
Any type implementing this must be represented as a measurement of a monotonically nondecreasing clock.
Required Associated Constants§
Sourceconst IGNORE_THRESHOLD: Duration
const IGNORE_THRESHOLD: Duration
An unrealistically large time jump.
We assume that any time change larger than this indicates a broken monotonic clock, and the bucket will not be refilled.
Required Methods§
Sourcefn checked_add(&self, duration: Duration) -> Option<Self>
fn checked_add(&self, duration: Duration) -> Option<Self>
See Instant::checked_add.
Sourcefn checked_duration_since(&self, earlier: Self) -> Option<Duration>
fn checked_duration_since(&self, earlier: Self) -> Option<Duration>
Provided Methods§
Sourcefn saturating_duration_since(&self, earlier: Self) -> Duration
fn saturating_duration_since(&self, earlier: Self) -> Duration
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.