pub struct HostBudget { /* private fields */ }Expand description
Per-host in-flight counter. Cheap clone (Arc).
Implementations§
Source§impl HostBudget
impl HostBudget
pub fn new() -> Self
Sourcepub async fn try_acquire(&self, host: &str, cap: u32) -> bool
pub async fn try_acquire(&self, host: &str, cap: u32) -> bool
Returns true and increments the count if host has room
under cap; returns false (no change) otherwise. cap = 0
blocks all calls to this host (defensive default).
Trait Implementations§
Source§impl Clone for HostBudget
impl Clone for HostBudget
Source§fn clone(&self) -> HostBudget
fn clone(&self) -> HostBudget
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 moreSource§impl Default for HostBudget
impl Default for HostBudget
Source§fn default() -> HostBudget
fn default() -> HostBudget
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for HostBudget
impl !RefUnwindSafe for HostBudget
impl Send for HostBudget
impl Sync for HostBudget
impl Unpin for HostBudget
impl UnsafeUnpin for HostBudget
impl !UnwindSafe for HostBudget
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