pub struct ProtocolConfig {
pub preferred_version: ProtocolVersion,
pub supported_versions: Vec<ProtocolVersion>,
pub allow_fallback: bool,
}Expand description
Protocol version configuration.
Fields§
§preferred_version: ProtocolVersionPreferred protocol version.
supported_versions: Vec<ProtocolVersion>Supported protocol versions.
allow_fallback: boolAllow fallback to server’s preferred version if client’s is unsupported.
Implementations§
Source§impl ProtocolConfig
impl ProtocolConfig
Sourcepub fn strict(version: impl Into<ProtocolVersion>) -> Self
pub fn strict(version: impl Into<ProtocolVersion>) -> Self
Create a strict configuration that only accepts the specified version.
Sourcepub fn multi_version() -> Self
pub fn multi_version() -> Self
Create a multi-version configuration that accepts all stable versions.
The preferred version is the latest stable. Older clients are accepted and responses are filtered through the appropriate version adapter.
Sourcepub fn is_supported(&self, version: &ProtocolVersion) -> bool
pub fn is_supported(&self, version: &ProtocolVersion) -> bool
Check if a protocol version is supported.
Trait Implementations§
Source§impl Clone for ProtocolConfig
impl Clone for ProtocolConfig
Source§fn clone(&self) -> ProtocolConfig
fn clone(&self) -> ProtocolConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProtocolConfig
impl Debug for ProtocolConfig
Source§impl Default for ProtocolConfig
impl Default for ProtocolConfig
Source§fn default() -> Self
fn default() -> Self
Multi-version by default in v3.1.
Pre-3.1 the default was exact-match against LATEST, which silently
rejected clients on older stable spec versions even though we ship
version adapters for them. The spec permits the server to choose a
different version than the client requested; defaulting to the full
stable set unblocks older clients while still preferring the newest.
Use Self::strict to restore the old single-version behavior.