pub struct Slots { /* private fields */ }Expand description
A bound on how many runs may be live at once, with a queue for the rest.
Implementations§
Source§impl Slots
impl Slots
Sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
Creates a flight line with capacity slots.
A capacity of zero is treated as one. A factory that cannot start anything is not a safer factory, it is a broken one, and the configuration is checked separately.
Sourcepub fn is_live(&self, run: &RunId) -> bool
pub fn is_live(&self, run: &RunId) -> bool
Returns true when this run is currently occupying a slot.
Sourcepub fn request(&mut self, run: RunId) -> Admission
pub fn request(&mut self, run: RunId) -> Admission
Asks for a slot.
Asking twice for the same run is not an error and does not take a second slot: the Tower may retry, and a rail that leaked a slot per retry would throttle itself to a standstill without anything looking wrong.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Slots
impl RefUnwindSafe for Slots
impl Send for Slots
impl Sync for Slots
impl Unpin for Slots
impl UnsafeUnpin for Slots
impl UnwindSafe for Slots
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