pub trait Upstream: Send + Sync {
// Required method
fn open(
&self,
) -> impl Future<Output = Result<OpenedUpstream, UpstreamError>> + Send;
}Expand description
Opens upstreams, one per downstream client.
Called once for each client, and each call is expected to produce a fresh
connection. An implementation that hands back the same connection twice
reintroduces exactly the sharing this exists to prevent, and a bridge that
does it will lose a tools/list_changed or fail to answer a sampling
request with no error anywhere to show for it.
Required Methods§
Sourcefn open(
&self,
) -> impl Future<Output = Result<OpenedUpstream, UpstreamError>> + Send
fn open( &self, ) -> impl Future<Output = Result<OpenedUpstream, UpstreamError>> + Send
Opens and negotiates one upstream.
§Errors
UpstreamError when the server could not be reached or refused the
handshake. This is the only failure channel on purpose: a client whose
server is unreachable has no bridge to be proxied through, so the caller
answers the client rather than starting a loop that would fail on its
first frame.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".