pub struct DeviceThrottle { /* private fields */ }Expand description
Per-device request coordination primitive.
This utility lets callers limit concurrent requests per target address and enforce a minimum delay between request starts.
Implementations§
Source§impl DeviceThrottle
impl DeviceThrottle
Sourcepub fn new(max_concurrent: usize, min_interval: Duration) -> Self
pub fn new(max_concurrent: usize, min_interval: Duration) -> Self
Creates a new throttle using the given defaults.
Sourcepub async fn set_device_limit(
&self,
address: DataLinkAddress,
max_concurrent: usize,
min_interval: Duration,
)
pub async fn set_device_limit( &self, address: DataLinkAddress, max_concurrent: usize, min_interval: Duration, )
Sets (or replaces) a per-device override.
Sourcepub async fn acquire(&self, address: DataLinkAddress) -> OwnedSemaphorePermit
pub async fn acquire(&self, address: DataLinkAddress) -> OwnedSemaphorePermit
Acquires a permit for address, respecting per-device concurrency and
minimum interval between request starts.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for DeviceThrottle
impl !RefUnwindSafe for DeviceThrottle
impl Send for DeviceThrottle
impl Sync for DeviceThrottle
impl Unpin for DeviceThrottle
impl UnsafeUnpin for DeviceThrottle
impl UnwindSafe for DeviceThrottle
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