expression
HTTP Version: metadata not negotiation
A message can carry a version marker. Assigning HTTP_2 to an in-memory request does not negotiate HTTP/2 or encode its frames. A transport is responsible for protocol support and negotiation. External crate example; constructs data in memory, does not send requests. Expected stdout (not executed): true Common mistake: Assuming a version field proves a negotiated connection uses that protocol.
Formal Syntax & Structure
rust syntaxrust
http::Version::{HTTP_11, HTTP_2}; request.version()Working Example
Example Snippetrust
fn main() { use http::{Request, Version}; let req = Request::builder().version(Version::HTTP_2).uri("/notes").body(()).unwrap(); println!("{}", req.version() == Version::HTTP_2);}