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
impl Clone for CancelSupport
Source§fn clone(&self) -> CancelSupport
fn clone(&self) -> CancelSupport
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more