pub fn check_version(
extensions: &Extensions,
negotiated: Version,
) -> Result<(), Error>Expand description
The one comparison, shared by every transport that honours a demand.
Ok(()) when there is no demand or negotiated satisfies it; a typed
VersionNotAvailable under
ErrorKind::Unsupported otherwise.
A function here rather than a == at each call site so that the rule —
exact match, absence means no demand — has one definition. Two
transports enforce it today and they must not drift.
What it does not do is decide when to call it. That is the whole
content of the guarantee: check_version at the wrong point is a check
that reports a violation after the bytes are already gone. Each caller
places it where the protocol is first known and no head has been
written, and pins that placement with a test that asserts the server
saw nothing.