pub struct RouteLimit { /* private fields */ }Expand description
The load-control limits for one route: an optional per-request timeout
(breach → 504) and an optional max_in_flight concurrency cap (breach →
503). Either, both, or neither; an empty RouteLimit is a no-op.
Implementations§
Source§impl RouteLimit
impl RouteLimit
Sourcepub fn new() -> Self
pub fn new() -> Self
An empty limit (no timeout, no concurrency cap). Build it up with
RouteLimit::timeout / RouteLimit::max_in_flight.
Sourcepub fn timeout(self, budget: Duration) -> Self
pub fn timeout(self, budget: Duration) -> Self
Cut a request off with 504 if it outlives budget.
Sourcepub fn max_in_flight(self, max: usize) -> Self
pub fn max_in_flight(self, max: usize) -> Self
Admit at most max concurrent requests to this route; shed the rest with
503 (fail fast, never queue). 0 is clamped to 1 so a route is never
wedged shut by a typo.
Trait Implementations§
Source§impl Clone for RouteLimit
impl Clone for RouteLimit
Source§impl Debug for RouteLimit
impl Debug for RouteLimit
Auto Trait Implementations§
impl Forget for RouteLimit
impl Freeze for RouteLimit
impl Move for RouteLimit
impl RefUnwindSafe for RouteLimit
impl Send for RouteLimit
impl Sync for RouteLimit
impl Unpin for RouteLimit
impl UnsafeUnpin for RouteLimit
impl UnwindSafe for RouteLimit
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