Skip to main content

DeferredShrink

Struct DeferredShrink 

Source
pub struct DeferredShrink { /* private fields */ }
Expand description

Grow immediately (stay responsive), but shrink only after the idle surplus has persisted for cooldown — damps grow→shrink→grow flapping. Holds its pending shrink deadline in a Cell<Option<Instant>> (interior mutability under &self, since the pool is a static); None = no shrink pending.

Implementations§

Source§

impl DeferredShrink

Source

pub const fn new(cooldown: Duration) -> Self

Create a policy that defers each shrink by cooldown after the pool first becomes over-provisioned.

Trait Implementations§

Source§

impl ScalingPolicy for DeferredShrink

Source§

fn decide(&self, s: PoolStats, now: Instant) -> ScaleAction

Decide what to do given the current pool stats at time now.
Source§

fn deferred_until(&self) -> Option<Instant>

The next instant at which the pool must be re-evaluated even without a status signal (e.g. a deferred shrink’s cooldown). None = nothing pending. The supervisor arms a one-shot timer for it.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.