Skip to main content

AdmittedRequest

Struct AdmittedRequest 

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

A request a RequestGate admitted, held by the source for as long as the request is in flight: dropping it — on every exit, a cancelled or failed one included — tells the gate the request is over through RequestGate::request_ended, exactly once.

Bind it (let admitted = …) and drop it once the response has been read, or the request failed; never hold it across a wait before a retry or across another request’s ask, since a gate admitting one request at a time would then wait on itself.

Implementations§

Source§

impl AdmittedRequest

Source

pub fn end(self)

End the request now, rather than when the admission goes out of scope.

Source

pub fn end_reporting(self, cost: &ReportedCost)

Tell the gate that admitted this request what its response said the request cost — through RequestGate::cost_reported — and then end it, as Self::end does: so the cost is delivered at most once, after whatever [<dyn RequestGate>::after] the response carried, and before RequestGate::request_ended. With no gate installed, nothing is told.

Trait Implementations§

Source§

impl Debug for AdmittedRequest

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for AdmittedRequest

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.