#[non_exhaustive]pub struct Policy {
pub burst: usize,
pub tokens: usize,
pub period: Duration,
pub apply: usize,
pub name: Option<&'static str>,
}Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.burst: usize§tokens: usize§period: Duration§apply: usize§name: Option<&'static str>Implementations§
Source§impl Policy
impl Policy
pub const fn new( burst: usize, tokens: usize, period: Duration, apply: usize, ) -> Policy
pub const fn from_tokens_per_second(tokens: usize) -> Policy
pub const fn from_tokens_per_minute(tokens: usize) -> Policy
pub const fn from_tokens_per_hour(tokens: usize) -> Policy
pub const fn from_tokens_per_day(tokens: usize) -> Policy
pub const fn from_tokens_per_period(tokens: usize, period: Duration) -> Policy
pub const fn max_burst(self, burst: usize) -> Policy
pub const fn apply_tokens(self, apply: usize) -> Policy
pub const fn name(self, name: &'static str) -> Policy
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Policy
impl RefUnwindSafe for Policy
impl Send for Policy
impl Sync for Policy
impl Unpin for Policy
impl UnwindSafe for Policy
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