pub struct SubscriberLimit {
total: usize,
per_caller: usize,
held: Mutex<Counts>,
}Expand description
The two bounds, and what is currently held against them.
Fields§
§total: usize§per_caller: usize§held: Mutex<Counts>Implementations§
Source§impl SubscriberLimit
impl SubscriberLimit
Sourcepub fn new(total: usize, per_caller: usize) -> Self
pub fn new(total: usize, per_caller: usize) -> Self
A limiter with bounds of a deployment’s own choosing.
Sourcepub fn take(self: &Arc<Self>, caller: &str) -> Option<SubscriberSlot>
pub fn take(self: &Arc<Self>, caller: &str) -> Option<SubscriberSlot>
Takes a slot for caller, or None if either bound is full.
The slot is released when what it is handed back to drops, so a caller that disconnects gives its slot back without anything having to notice the disconnection.
Sourcepub fn held(&self) -> usize
pub fn held(&self) -> usize
How many streams are open right now. For a test, and for anything that later wants to log it.
fn release(&self, caller: &str)
Trait Implementations§
Source§impl Debug for SubscriberLimit
impl Debug for SubscriberLimit
Auto Trait Implementations§
impl !Freeze for SubscriberLimit
impl RefUnwindSafe for SubscriberLimit
impl Send for SubscriberLimit
impl Sync for SubscriberLimit
impl Unpin for SubscriberLimit
impl UnsafeUnpin for SubscriberLimit
impl UnwindSafe for SubscriberLimit
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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