Struct throttle::ThrottleSpec
source · pub struct ThrottleSpec {
pub limit: u64,
pub period: u64,
pub max_burst: Option<u64>,
pub force_local: bool,
}
Fields§
§limit: u64
§period: u64
Period, in seconds
max_burst: Option<u64>
§force_local: bool
Implementations§
source§impl ThrottleSpec
impl ThrottleSpec
pub async fn throttle<S: AsRef<str>>( &self, key: S, ) -> Result<ThrottleResult, Error>
pub async fn throttle_quantity<S: AsRef<str>>( &self, key: S, quantity: u64, ) -> Result<ThrottleResult, Error>
Trait Implementations§
source§impl Clone for ThrottleSpec
impl Clone for ThrottleSpec
source§fn clone(&self) -> ThrottleSpec
fn clone(&self) -> ThrottleSpec
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ThrottleSpec
impl Debug for ThrottleSpec
source§impl<'de> Deserialize<'de> for ThrottleSpec
impl<'de> Deserialize<'de> for ThrottleSpec
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
source§impl Display for ThrottleSpec
impl Display for ThrottleSpec
source§impl Hash for ThrottleSpec
impl Hash for ThrottleSpec
source§impl PartialEq for ThrottleSpec
impl PartialEq for ThrottleSpec
source§fn eq(&self, other: &ThrottleSpec) -> bool
fn eq(&self, other: &ThrottleSpec) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for ThrottleSpec
impl Serialize for ThrottleSpec
source§impl TryFrom<&str> for ThrottleSpec
impl TryFrom<&str> for ThrottleSpec
source§impl TryFrom<String> for ThrottleSpec
impl TryFrom<String> for ThrottleSpec
impl Copy for ThrottleSpec
impl Eq for ThrottleSpec
impl StructuralPartialEq for ThrottleSpec
Auto Trait Implementations§
impl Freeze for ThrottleSpec
impl RefUnwindSafe for ThrottleSpec
impl Send for ThrottleSpec
impl Sync for ThrottleSpec
impl Unpin for ThrottleSpec
impl UnwindSafe for ThrottleSpec
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more