1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use ;
use crate::;
/// An asynchronous, backend-independent rate limiter.
///
/// Implementations evaluate one check or an atomic batch using their own
/// authoritative time source. The returned futures are [`Send`], so adapters
/// can await them on a multithreaded executor without Runlimit depending on a
/// particular async runtime.
///
/// This trait uses return-position `impl Future` for static dispatch without
/// requiring a boxed future. It is intentionally not object-safe. Applications
/// that need runtime backend selection can implement `Limiter` for an
/// application-owned enum and delegate to each variant. The executor
/// portability guarantee also requires limiter and error types to be [`Send`]
/// and [`Sync`], excluding deliberately single-thread-only implementations.