token_bucket/error/
impl.rs1use super::*;
2
3impl fmt::Display for RateLimitError {
5 #[inline(always)]
16 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
17 match self {
18 Self::ZeroRate => f.write_str(ERR_ZERO_RATE),
19 Self::ZeroBurst => f.write_str(ERR_ZERO_BURST),
20 Self::ZeroPeriod => f.write_str(ERR_ZERO_PERIOD),
21 Self::InvalidLimit => f.write_str(ERR_INVALID_LIMIT),
22 Self::InvalidCapacity => f.write_str(ERR_INVALID_CAPACITY),
23 Self::ZeroCapacity => f.write_str(ERR_ZERO_CAPACITY),
24 Self::Overflow => f.write_str(ERR_OVERFLOW),
25 }
26 }
27}
28
29impl Error for RateLimitError {}