[−][src]Struct async_listen::backpressure::Sender
The handle that controls backpressure
It can be used to create tokens, changing limit and getting metrics.
See new
for more details
Methods
impl Sender
[src]
pub fn token(&self) -> Token
[src]
Acquire a backpressure token
The token holds one unit of resource
Note: You can always acquire a token, even if capacity limit reached.
pub fn set_limit(&self, new_limit: usize)
[src]
Change the limit for the number of connections
If limit is increased it's applied immediately. If limit is lowered, we can't drop connections. So listening stream is paused until there are less then new limit tokens alive (i.e. first dropped tokens may not unblock the stream).
pub fn get_active_tokens(&self) -> usize
[src]
Returns the number of currently active tokens
Can return a value larger than limit if tokens are created manually.
This can be used for metrics or debugging. You should not rely on
this value being in sync. There is also no way to wake-up when this
value is lower than limit, also see
has_capacity
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Sender
impl Send for Sender
impl Sync for Sender
impl Unpin for Sender
impl UnwindSafe for Sender
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,