Skip to main content

run_client

Function run_client 

Source
pub async fn run_client<U, C, S, K>(
    upstream: &U,
    policy: DegradePolicy,
    config: DownstreamConfig,
    codec: C,
    source: S,
    sink: K,
) -> Result<LoopReport, BridgeClientError>
Expand description

Runs one client from end to end against its own upstream.

The only supported way to run a BridgeLoop against a caller-chosen upstream, because it is the only one that guarantees the two halves were opened together. A caller assembling a Wiring by hand can still do it, and can still get it wrong; this is the shape that cannot be wrong by omission.

§Errors

BridgeClientError::Upstream when this client’s server could not be reached, and BridgeClientError::Loop when the client’s own channel fails. The two are kept apart because they mean opposite things to whoever is serving: the first is a server the bridge cannot reach, the second is a client that went away mid-conversation.