pub struct VelocityLimit {
pub max_spends: u32,
pub window_secs: u64,
}Expand description
速率限制:滑动窗口内至多 VelocityLimit::max_spends 笔成功放行。
只有成功放行计入(拒绝不耗号也不占窗口槽);窗口按委托计。
Fields§
§max_spends: u32窗口内允许的最大成功放行笔数(≥ 1)。
window_secs: u64滑动窗口长度(秒,≥ 1)。一笔在 t + window_secs 时刻起不再计入
(半开:恰在窗口结束时刻已释放,与过期语义同形)。
Trait Implementations§
Source§impl Clone for VelocityLimit
impl Clone for VelocityLimit
Source§fn clone(&self) -> VelocityLimit
fn clone(&self) -> VelocityLimit
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for VelocityLimit
Source§impl Debug for VelocityLimit
impl Debug for VelocityLimit
Source§impl<'de> Deserialize<'de> for VelocityLimit
impl<'de> Deserialize<'de> for VelocityLimit
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for VelocityLimit
Source§impl PartialEq for VelocityLimit
impl PartialEq for VelocityLimit
Source§impl Serialize for VelocityLimit
impl Serialize for VelocityLimit
impl StructuralPartialEq for VelocityLimit
Auto Trait Implementations§
impl Freeze for VelocityLimit
impl RefUnwindSafe for VelocityLimit
impl Send for VelocityLimit
impl Sync for VelocityLimit
impl Unpin for VelocityLimit
impl UnsafeUnpin for VelocityLimit
impl UnwindSafe for VelocityLimit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more