Skip to main content

DynThrottle

Struct DynThrottle 

Source
pub struct DynThrottle<'dynosaur_struct> { /* private fields */ }
Expand description

Dyn-compatible wrapper for Throttle.

Implementations§

Source§

impl<'dynosaur_struct> DynThrottle<'dynosaur_struct>

Source

pub fn new_box( value: impl Throttle + 'dynosaur_struct, ) -> _Box<DynThrottle<'dynosaur_struct>>

Create Box<DynThrottle> from a value implementing Throttle.

Source

pub fn new_arc( value: impl Throttle + 'dynosaur_struct, ) -> _Arc<DynThrottle<'dynosaur_struct>> ⓘ

Create Arc<DynThrottle> from a value implementing Throttle.

Source

pub fn new_rc( value: impl Throttle + 'dynosaur_struct, ) -> _Rc<DynThrottle<'dynosaur_struct>>

Create Rc<DynThrottle> from a value implementing Throttle.

Source

pub const fn from_box( value: _Box<impl Throttle + 'dynosaur_struct>, ) -> _Box<DynThrottle<'dynosaur_struct>>

Convert Box<impl Throttle> to Box<DynThrottle>.

Source

pub const fn from_arc( value: _Arc<impl Throttle + 'dynosaur_struct>, ) -> _Arc<DynThrottle<'dynosaur_struct>> ⓘ

Convert Arc<impl Throttle> to Arc<DynThrottle>.

Source

pub const fn from_rc( value: _Rc<impl Throttle + 'dynosaur_struct>, ) -> _Rc<DynThrottle<'dynosaur_struct>>

Convert Rc<impl Throttle> to Rc<DynThrottle>.

Source

pub const fn from_ref( value: &(impl Throttle + 'dynosaur_struct), ) -> &DynThrottle<'dynosaur_struct>

Convert &impl Throttle to &DynThrottle.

Source

pub const fn from_mut( value: &mut (impl Throttle + 'dynosaur_struct), ) -> &mut DynThrottle<'dynosaur_struct>

Convert &mut impl Throttle to &mut DynThrottle.

Trait Implementations§

Source§

impl<'dynosaur_struct> Throttle for DynThrottle<'dynosaur_struct>

Source§

fn acquire( &self, meta: &RequestMeta<'_>, ) -> impl Future<Output = Result<Charge, Refused>> + Send

Wait until the request may be sent, and charge it. Read more
Source§

fn observe( &self, charge: &Charge, response: &ResponseMeta<'_>, attempt: &AttemptInfo, )

See a response to an attempt acquire charged. Runs on every response, before the policy decides. Records counts and tiers only.
Source§

fn hold(&self, delay: Duration)

Hold every request on this throttle for delay. A hold only ever extends.

Auto Trait Implementations§

§

impl<'dynosaur_struct> !Freeze for DynThrottle<'dynosaur_struct>

§

impl<'dynosaur_struct> !RefUnwindSafe for DynThrottle<'dynosaur_struct>

§

impl<'dynosaur_struct> !Sized for DynThrottle<'dynosaur_struct>

§

impl<'dynosaur_struct> !Unpin for DynThrottle<'dynosaur_struct>

§

impl<'dynosaur_struct> !UnsafeUnpin for DynThrottle<'dynosaur_struct>

§

impl<'dynosaur_struct> !UnwindSafe for DynThrottle<'dynosaur_struct>

§

impl<'dynosaur_struct> Send for DynThrottle<'dynosaur_struct>

§

impl<'dynosaur_struct> Sync for DynThrottle<'dynosaur_struct>

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more