Skip to main content

CancelSupport

Enum CancelSupport 

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

Whether dropping the future returned by Transport::execute stops the exchange — see that method’s doc comment for the contract itself, of which this enum is the one honest way out.

§Why two variants and not three

A third variant could split Supported by who performs the cancellation: the transport tearing down a socket it owns, versus the transport asking an ambient host to stop. It is not here because no caller decision turns on the difference. A capability answers a question the caller actually asks — here, “can I rely on a drop ending the exchange?” — and who ends it is an implementation detail. Both shapes give a guarantee of exactly the same strength, including its limit: bytes already sent are already sent, and the server may have acted on them either way.

The distinction is worth knowing even though it is not worth a variant: hclient-native owns the socket and closes it itself, while hclient-fetch and hclient-wasi ask the browser and the wasi:http host — AbortController::abort() and the Component Model’s subtask.cancel. Only the first kind can pool connections, which is why the pool lives in hclient-native and nowhere else.

Not #[non_exhaustive], deliberately: no other enum in this file is, and consistency across the capability set is worth more than reserving the right to add a variant to this one alone.

Variants§

§

None

Dropping the future does not stop the exchange: it may run to completion, unobserved, on a connection this transport no longer reports on.

The conservative base — Capabilities::default() returns this — and here, unlike RedirectSupport::None, that costs nothing. A default must never be stronger than the truth: a backend that never touches this field is read as “do not rely on a drop stopping anything”, which is the safe reading of silence and is also exactly what a backend that genuinely cannot cancel means. The two coincide, so there is nothing to tell apart — whereas for redirects they did not: None there is a substantive “redirects are impossible”, which is a far stronger claim than “the field was not filled in”, and a transparent backend forced to say it was misread.

§

Supported

Dropping the future stops the exchange, as far as this transport controls it.

What that does and does not promise is the contract on Transport::execute; the short version is that our side stops, and the server’s side is not ours to promise anything about.

Trait Implementations§

Source§

impl Clone for CancelSupport

Source§

fn clone(&self) -> CancelSupport

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 CancelSupport

Source§

impl Debug for CancelSupport

Source§

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

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

impl Default for CancelSupport

Source§

fn default() -> CancelSupport

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

impl Eq for CancelSupport

Source§

impl PartialEq for CancelSupport

Source§

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

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.