no_std_http/version.rs
1//! HTTP version
2//!
3//! This module contains a definition of the `Version` type. The `Version`
4//! type is intended to be accessed through the root of the crate
5//! (`http::Version`) rather than this module.
6//!
7//! The `Version` type contains constants that represent the various versions
8//! of the HTTP protocol.
9//!
10//! # Examples
11//!
12//! ```
13//! use http::Version;
14//!
15//! let http11 = Version::Http11;
16//! let http2 = Version::H2;
17//! assert!(http11 != http2);
18//!
19//! println!("{:?}", http2);
20//! ```
21
22use strum::AsRefStr;
23
24/// Represents a version of the HTTP spec.
25#[derive(Debug, Default, PartialEq, PartialOrd, Copy, Clone, Eq, Ord, Hash, AsRefStr)]
26pub enum Version {
27 #[strum(serialize = "HTTP/0.9")]
28 Http09,
29 #[strum(serialize = "HTTP/1.0")]
30 Http10,
31 #[default]
32 #[strum(serialize = "HTTP/1.1")]
33 Http11,
34 #[strum(serialize = "HTTP/2.0")]
35 H2,
36 #[strum(serialize = "HTTP/3.0")]
37 H3,
38}