pub trait Upstream {
type Target;
// Required methods
fn send<'a>(
&'a self,
target: &'a Self::Target,
request: WireRequest<HttpBody>,
) -> CapabilityFuture<'a, Result<WireResponse<HttpBody>, CapabilityError>>;
fn connect<'a>(
&'a self,
target: &'a Self::Target,
request: WireRequest<()>,
) -> CapabilityFuture<'a, Result<UpstreamConnection, CapabilityError>>;
fn limits(&self) -> CapabilityLimits;
}Expand description
The upstream transport family.
Required Associated Types§
Required Methods§
Sourcefn send<'a>(
&'a self,
target: &'a Self::Target,
request: WireRequest<HttpBody>,
) -> CapabilityFuture<'a, Result<WireResponse<HttpBody>, CapabilityError>>
fn send<'a>( &'a self, target: &'a Self::Target, request: WireRequest<HttpBody>, ) -> CapabilityFuture<'a, Result<WireResponse<HttpBody>, CapabilityError>>
Sends one already-encoded request. A non-2xx HTTP response is returned
as Ok(WireResponse) and is never converted into a capability error.
Hosts must validate that the request path is origin-relative and
compatible with target, and must replace or remove request auth in
both headers and query parameters (such as key or access_token)
rather than inheriting source credentials. Implementations never route or
recursively invoke conversion.
Sourcefn connect<'a>(
&'a self,
target: &'a Self::Target,
request: WireRequest<()>,
) -> CapabilityFuture<'a, Result<UpstreamConnection, CapabilityError>>
fn connect<'a>( &'a self, target: &'a Self::Target, request: WireRequest<()>, ) -> CapabilityFuture<'a, Result<UpstreamConnection, CapabilityError>>
Performs an HTTP upgrade. A rejected handshake is a response result,
including its full body, while transport failures are errors. The same
origin-relative path, target compatibility, and source-auth replacement
rules as Self::send apply.
Sourcefn limits(&self) -> CapabilityLimits
fn limits(&self) -> CapabilityLimits
Limits bound to this capability instance.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".