rusty_feeder/provider/rate_limit.rs
1/// Rate limit types for exchanges
2#[derive(Debug, Clone, Copy, PartialEq, Eq)]
3pub enum RateLimitType {
4 /// Weight-based rate limit (common in many exchanges)
5 RequestWeight,
6
7 /// Order-specific rate limits
8 Orders,
9
10 /// Raw request count limits
11 RawRequests,
12
13 /// API endpoint specific limits
14 Endpoint,
15}
16
17/// Memory-efficient rate limit information with enhanced details
18/// Optimized for minimal allocation and cache efficiency
19#[derive(Debug, Clone)]
20#[repr(align(16))] // Align for better memory access
21pub struct RateLimit {
22 /// Type of limit as a String (e.g., "REQUEST_WEIGHT", "ORDERS")
23 pub limit_type: &'static str,
24
25 /// Interval type (e.g., "MINUTE", "SECOND", "DAY")
26 pub interval: &'static str,
27
28 /// Number of intervals (e.g., 1 for 1 MINUTE)
29 pub interval_num: u32,
30
31 /// Maximum count/weight allowed in the interval
32 pub limit: u64,
33}