pub struct Ratelimit { /* private fields */ }Expand description
Implementations§
Source§impl Ratelimit
impl Ratelimit
Sourcepub fn project<'__this>(self: Pin<&'__this mut Self>) -> __Projection<'__this>
pub fn project<'__this>(self: Pin<&'__this mut Self>) -> __Projection<'__this>
Pin-projects all fields of Self.
These fields are structurally pinned:
inner
These fields are not structurally pinned:
Sourcepub fn with_project<'__this, R>(
self: Pin<&'__this mut Self>,
f: impl FnOnce(__ProjectionLt<'__this>) -> R,
) -> R
pub fn with_project<'__this, R>( self: Pin<&'__this mut Self>, f: impl FnOnce(__ProjectionLt<'__this>) -> R, ) -> R
Pin-projects all fields of Self with proper lifetime.
These fields are structurally pinned:
inner
These fields are not structurally pinned:
Sourcepub fn with_project_ref<'__this, R>(
self: Pin<&'__this Self>,
f: impl FnOnce(__ProjectionRef<'__this>) -> R,
) -> R
pub fn with_project_ref<'__this, R>( self: Pin<&'__this Self>, f: impl FnOnce(__ProjectionRef<'__this>) -> R, ) -> R
Pin-projects all fields of Self from a shared reference with proper lifetime.
These fields are structurally pinned:
inner
These fields are not structurally pinned:
Source§impl Ratelimit
impl Ratelimit
Sourcepub const DEFAULT_INTERVAL: i32
pub const DEFAULT_INTERVAL: i32
The default interval used for rate limiting.
Sourcepub const DEFAULT_BURST: i32
pub const DEFAULT_BURST: i32
The default burst size.
Sourcepub fn new(interval: i32, burst: i32) -> impl PinInit<Self>
pub fn new(interval: i32, burst: i32) -> impl PinInit<Self>
Constructs a Ratelimit with the specified configuration.
If interval is zero, then no rate limit is applied.
Sourcepub fn new_default() -> impl PinInit<Self>
pub fn new_default() -> impl PinInit<Self>
Constructs a Ratelimit with the default configuration.
Sourcepub const unsafe fn new_static(
name: &'static CStr,
interval: i32,
burst: i32,
) -> Self
pub const unsafe fn new_static( name: &'static CStr, interval: i32, burst: i32, ) -> Self
Trait Implementations§
Source§impl PinnedDrop for Ratelimit
impl PinnedDrop for Ratelimit
impl Send for Ratelimit
impl Sync for Ratelimit
Auto Trait Implementations§
impl !Freeze for Ratelimit
impl !RefUnwindSafe for Ratelimit
impl !UnsafeUnpin for Ratelimit
impl UnwindSafe for Ratelimit
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<S, T> IntoSafeCast<T> for Swhere
T: FromSafeCast<S>,
impl<S, T> IntoSafeCast<T> for Swhere
T: FromSafeCast<S>,
Source§fn into_safe_cast(self) -> T
fn into_safe_cast(self) -> T
Convert
self into a T. This operation is guaranteed to be lossless.Source§impl<S, T> IntoSafeCastArch<T> for Swhere
T: FromSafeCastArch<S>,
impl<S, T> IntoSafeCastArch<T> for Swhere
T: FromSafeCastArch<S>,
Source§fn into_safe_cast_arch(self) -> T
fn into_safe_cast_arch(self) -> T
Convert
self into a T. This operation is guaranteed to be lossless.