pub struct DownstreamConfig { /* private fields */ }Expand description
What this bridge presents to a client, before any client has connected.
Fixed for the life of the deployment, unlike the negotiation itself: which
revisions are acceptable, which transport the client arrived over, and what
this bridge calls itself are properties of the running process, not of any
one session. Bundling them here is what lets negotiate take the one
thing that varies per connection and nothing else.
§Examples
use protocol_droid::application::bridge::{DownstreamConfig, DownstreamError};
use protocol_droid::domain::TransportKind;
let config = DownstreamConfig::new("bridge", "0.1.0", TransportKind::Stdio)?;
assert_eq!(config.transport(), TransportKind::Stdio);Implementations§
Source§impl DownstreamConfig
impl DownstreamConfig
Sourcepub fn new(
name: impl Into<String>,
version: impl Into<String>,
transport: TransportKind,
) -> Result<Self, DownstreamError>
pub fn new( name: impl Into<String>, version: impl Into<String>, transport: TransportKind, ) -> Result<Self, DownstreamError>
A config accepting every revision this build speaks.
§Errors
DownstreamError::UnnegotiableVersion if the build has no revisions
at all. The list is a build-time constant and the specification has
defined at least one since 2024, so this is a formality rather than a
branch — but a caller building a config at startup deserves a real error
rather than a panic further in.
Sourcepub const fn with(
supported: SupportedVersions,
identity: Identity,
transport: TransportKind,
) -> Self
pub const fn with( supported: SupportedVersions, identity: Identity, transport: TransportKind, ) -> Self
A config restricted to supported, naming itself identity.
For a bridge deliberately held to fewer revisions than the build supports — an operator who knows a client is broken at a revision and would rather see a counter-offer than a mis-negotiation.
Sourcepub const fn transport(&self) -> TransportKind
pub const fn transport(&self) -> TransportKind
The transport a client reaches this bridge over.
Part of the negotiation and not an incidental detail: the same feature set can resolve differently over stdio than over HTTP, because the transport gates features of its own.
Sourcepub const fn supported(&self) -> &SupportedVersions
pub const fn supported(&self) -> &SupportedVersions
The revisions this bridge will accept downstream.