pub struct H3Policy<C> { /* private fields */ }Expand description
The opportunistic HTTP/3 decision: what has been advertised, which networks have unusable UDP, and what the next request should dial.
Implementations§
Source§impl<C: MonotonicClock> H3Policy<C>
impl<C: MonotonicClock> H3Policy<C>
Sourcepub fn new(clock: C, capable: bool) -> Self
pub fn new(clock: C, capable: bool) -> Self
A policy over clock. capable says whether the build has an HTTP/3 transport; an
incapable policy still records what it observes and always answers TCP.
Sourcepub fn for_build(clock: C) -> Self
pub fn for_build(clock: C) -> Self
The policy for this build: capable only where the http3 feature compiled the transport
that dials QUIC, so H3Policy::choose never answers a race that nothing could dial.
Sourcepub fn observe_alt_svc(&self, origin: &str, header: &str)
pub fn observe_alt_svc(&self, origin: &str, header: &str)
Record an Alt-Svc header origin answered with. clear, or a header naming no usable
h3 alternative, withdraws the origin’s advertisement; otherwise the first h3
alternative replaces it.
Sourcepub fn observe_https_record(
&self,
origin: &str,
origin_port: u16,
record: &HttpsRecord,
)
pub fn observe_https_record( &self, origin: &str, origin_port: u16, record: &HttpsRecord, )
Record an HTTPS DNS record for origin whose port is origin_port. A record without h3
in its alpn changes nothing: DNS is one of two discovery sources, so its silence does
not withdraw what Alt-Svc advertised.
Sourcepub fn record_udp_unusable(&self, network: PathGeneration, failure: UdpFailure)
pub fn record_udp_unusable(&self, network: PathGeneration, failure: UdpFailure)
Record UDP as unusable on network for UDP_UNUSABLE_TTL. Requests already started
keep their transport; the next Self::choose on this network answers TCP.
Sourcepub fn choose(&self, origin: &str, network: PathGeneration) -> TransportChoice
pub fn choose(&self, origin: &str, network: PathGeneration) -> TransportChoice
How a request to origin starting now on network is dialed.
Trait Implementations§
Auto Trait Implementations§
impl<C> !Freeze for H3Policy<C>
impl<C> RefUnwindSafe for H3Policy<C>where
C: RefUnwindSafe,
impl<C> Send for H3Policy<C>where
C: Send,
impl<C> Sync for H3Policy<C>where
C: Sync,
impl<C> Unpin for H3Policy<C>where
C: Unpin,
impl<C> UnsafeUnpin for H3Policy<C>where
C: UnsafeUnpin,
impl<C> UnwindSafe for H3Policy<C>where
C: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more