pub struct ClientConfig { /* private fields */ }Expand description
What a client offers a server, before anything is negotiated.
Implementations§
Source§impl ClientConfig
impl ClientConfig
Sourcepub fn new(version: ProtocolVersion, transport: TransportKind) -> Self
pub fn new(version: ProtocolVersion, transport: TransportKind) -> Self
A client that speaks version, with nothing advertised.
Sourcepub fn speaking(
versions: impl IntoIterator<Item = ProtocolVersion>,
transport: TransportKind,
) -> Result<Self, ClientError>
pub fn speaking( versions: impl IntoIterator<Item = ProtocolVersion>, transport: TransportKind, ) -> Result<Self, ClientError>
A client that speaks several, most preferred first.
§Errors
Refuses an empty list, because a client that speaks no revision cannot negotiate and would otherwise fail much later with a message about something else entirely.
Sourcepub const fn with_capabilities(self, capabilities: CapabilitySet) -> Self
pub const fn with_capabilities(self, capabilities: CapabilitySet) -> Self
Declares the capabilities the client supports.
Sourcepub fn versions(&self) -> &[ProtocolVersion]
pub fn versions(&self) -> &[ProtocolVersion]
The revisions offered, most preferred first.
Sourcepub const fn capabilities(&self) -> CapabilitySet
pub const fn capabilities(&self) -> CapabilitySet
The capabilities this client declared.
Read by the handshake to render the initialize request, so it has to
be the same set the profile will be resolved from — a handshake that
advertised a different one would produce a session that claims to do
something it never told the server it could.
Sourcepub const fn transport(&self) -> TransportKind
pub const fn transport(&self) -> TransportKind
The transport the client will run over.
Sourcepub const fn negotiated_with(
&self,
version: ProtocolVersion,
server_caps: CapabilitySet,
) -> Negotiation
pub const fn negotiated_with( &self, version: ProtocolVersion, server_caps: CapabilitySet, ) -> Negotiation
The negotiation this offer produces against a server’s answer.
The one place the two halves are put together. A caller that already knows the version and the server’s capabilities — which is what a transport knows once the handshake is done — passes them here rather than leaving this type to invent a half-negotiation.