Skip to main content

Timeouts

Struct Timeouts 

Source
pub struct Timeouts {
    pub resolve: Option<Duration>,
    pub connect: Option<Duration>,
    pub first_byte: Option<Duration>,
    pub between_bytes: Option<Duration>,
}
Expand description

The timeout triple — wasi:http’s shape, the richest of the ambient models.

Collapses to a single AbortController in fetch; on native it splits into connector / response-wait / body-idle. A single Duration throws away information the WASI backend knows how to use.

Lives in hclient-core because transports read it from the request’s http::Extensions, and they don’t depend on hclient.

Fields§

§resolve: Option<Duration>

A bound on getting an address to try, separate from the connect budget that follows it.

§What it bounds, which is not a phase boundary

Happy Eyeballs interleaves resolution with connecting on purpose — the resolver is a Stream and hclient-native starts connecting to the first address while the rest are still arriving — so there is no instant at which resolution finished, and a bound on one would have nothing to attach to. What this bounds is the wait for the first address from either family, which is exactly the failure a caller cannot otherwise diagnose: a resolver that hangs looks like an origin that is unreachable, and only the first is worth a different retry.

It therefore does not apply where the connection does not depend on the resolver — an IP literal, and an HTTPS record carrying address hints, both of which give a connector somewhere to go without an answer.

§Why not simply a smaller connect

Because the two answer different questions and a caller who cares wants both: resolve says how long may I wait to learn where to go, connect says and how long may going there take. Folding them loses which one failed, which is the whole gap. Overlapping budgets are the caller’s to reconcile; nothing here subtracts one from the other, because a resolver that answered in 10 ms has not spent any of the connect budget in any sense a connector can see.

§connect: Option<Duration>§first_byte: Option<Duration>§between_bytes: Option<Duration>

Trait Implementations§

Source§

impl Clone for Timeouts

Source§

fn clone(&self) -> Timeouts

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Timeouts

Source§

impl Debug for Timeouts

Source§

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

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

impl Default for Timeouts

Source§

fn default() -> Timeouts

Returns the “default value” for a type. Read more
Source§

impl Eq for Timeouts

Source§

impl PartialEq for Timeouts

Source§

fn eq(&self, other: &Timeouts) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Timeouts

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.