Skip to main content

ReuseSupport

Enum ReuseSupport 

Source
pub enum ReuseSupport {
    None,
    Supported,
}
Expand description

Whether a request may travel over a connection an earlier request already used, or whether every request opens a socket of its own.

§Why two variants and not three

The v0.2 design document asked for three, on RedirectSupport’s precedent: reuse that is ours and configurable, reuse that belongs to an ambient host and is not ours to control (hclient-fetch, hclient-wasi), and none. The middle one is not here, and the reason is a sharper reading of RedirectSupport than “the owner differs”.

RedirectSupport::Internal earns its variant because check_supported refuses on it: ClientBuilder::redirect exists, it is a portable, client-level setting, and a backend that follows redirects internally would silently ignore it — so the variant is what turns a silent no-op into an UnsupportedCapability. That is a caller decision, made by code that can be pointed at.

No such setting exists for reuse. The pool is configured on the concrete transport that owns it (hclient_native::Native::pool), because a pool’s idle timeout is a property of a connection between requests and not of any one request — so there is nothing for check_supported to refuse, and a caller holding a generic T: Transport learns nothing actionable from who keeps the connection alive. The question the design document itself named — “are my requests going over reused connections, because it changes how I batch work” — is answered by the two variants below, and adding “who owns it” would re-add exactly the axis CancelSupport rejected one capability earlier.

The condition under which the third variant arrives, written down so the next reader does not have to re-derive it: as soon as there is a portable, client-level pool setting that a host-managed backend would have to reject, the variant arrives together with that setting and with its arm in check_supported — the same order in which RedirectSupport::Transparent arrived, once a backend existed that was being misread without it. Not before: a variant no caller can branch on is a distinction the capability set has to carry forever for nothing.

Variants§

§

None

Every request opens a new connection, and closes it when it is done.

The conservative base — Capabilities::default() returns this — and, as with CancelSupport::None, silence and the substantive claim coincide: a caller who reads this plans for a handshake per request, which is exactly what a backend that never filled the field in will give them.

§

Supported

Requests to the same origin may travel over a connection an earlier request already used.

Says nothing about when one is reused — that depends on what is idle at the moment, and no caller can predict it per request. What it does promise is the thing a caller batches on: a second request to an origin need not pay for a TCP and TLS handshake again.

Trait Implementations§

Source§

impl Clone for ReuseSupport

Source§

fn clone(&self) -> ReuseSupport

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 ReuseSupport

Source§

impl Debug for ReuseSupport

Source§

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

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

impl Default for ReuseSupport

Source§

fn default() -> ReuseSupport

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

impl Eq for ReuseSupport

Source§

impl PartialEq for ReuseSupport

Source§

fn eq(&self, other: &ReuseSupport) -> 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 ReuseSupport

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.