pub struct HttpConnectionLimiter { /* private fields */ }Implementations§
Source§impl HttpConnectionLimiter
impl HttpConnectionLimiter
pub fn new(cap: usize) -> Self
Sourcepub fn with_default_cap() -> Self
pub fn with_default_cap() -> Self
Default cap: (2 * available_parallelism).clamp(8, 256).
pub fn cap(&self) -> usize
pub fn current(&self) -> usize
Sourcepub fn try_acquire(&self) -> Option<HttpConnectionPermit>
pub fn try_acquire(&self) -> Option<HttpConnectionPermit>
Returns Some(permit) on success, None if the cap is full.
No blocking, no allocation on the hot path.
Trait Implementations§
Source§impl Clone for HttpConnectionLimiter
impl Clone for HttpConnectionLimiter
Source§fn clone(&self) -> HttpConnectionLimiter
fn clone(&self) -> HttpConnectionLimiter
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 moreAuto Trait Implementations§
impl Freeze for HttpConnectionLimiter
impl RefUnwindSafe for HttpConnectionLimiter
impl Send for HttpConnectionLimiter
impl Sync for HttpConnectionLimiter
impl Unpin for HttpConnectionLimiter
impl UnsafeUnpin for HttpConnectionLimiter
impl UnwindSafe for HttpConnectionLimiter
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request