pub enum HttpVersion {
Http0_9,
Http1_0,
Http1_1,
Http2,
Http3,
Unknown(String),
}Expand description
Represents the HTTP version used in the request or response.
This enum defines the various HTTP protocol versions supported,
including HTTP/0.9, HTTP/1.0, HTTP/1.1, HTTP/2, and HTTP/3.
It also includes an Unknown variant for unrecognized versions.
Variants§
Http0_9
HTTP version 0.9
Http1_0
HTTP version 1.0
Http1_1
HTTP version 1.1
Http2
HTTP version 2.0
Http3
HTTP version 3.0
Unknown(String)
Unknown version
Implementations§
Source§impl HttpVersion
impl HttpVersion
Sourcepub fn is_http0_9(&self) -> bool
pub fn is_http0_9(&self) -> bool
Checks if the current version is HTTP/0.9.
§Returns
true if the version is HTTP/0.9, false otherwise.
Sourcepub fn is_http1_0(&self) -> bool
pub fn is_http1_0(&self) -> bool
Checks if the current version is HTTP/1.0.
§Returns
true if the version is HTTP/1.0, false otherwise.
Sourcepub fn is_http1_1(&self) -> bool
pub fn is_http1_1(&self) -> bool
Checks if the current version is HTTP/1.1.
§Returns
true if the version is HTTP/1.1, false otherwise.
Sourcepub fn is_unknown(&self) -> bool
pub fn is_unknown(&self) -> bool
Sourcepub fn is_http1_1_or_higher(&self) -> bool
pub fn is_http1_1_or_higher(&self) -> bool
Checks if the current version is HTTP/1.1 or higher.
§Returns
true if the version is HTTP/1.1, HTTP/2, or HTTP/3, false otherwise.
Trait Implementations§
Source§impl Clone for HttpVersion
impl Clone for HttpVersion
Source§fn clone(&self) -> HttpVersion
fn clone(&self) -> HttpVersion
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 HttpVersion
impl Debug for HttpVersion
Source§impl Default for HttpVersion
impl Default for HttpVersion
Source§fn default() -> HttpVersion
fn default() -> HttpVersion
Source§impl<'de> Deserialize<'de> for HttpVersion
impl<'de> Deserialize<'de> for HttpVersion
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<HttpVersion, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<HttpVersion, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Display for HttpVersion
Implements the Display trait for HttpVersion, allowing it to be formatted as a string.
impl Display for HttpVersion
Implements the Display trait for HttpVersion, allowing it to be formatted as a string.
impl Eq for HttpVersion
Source§impl FromStr for HttpVersion
Implements the FromStr trait for HttpVersion, allowing conversion from a string slice.
impl FromStr for HttpVersion
Implements the FromStr trait for HttpVersion, allowing conversion from a string slice.
Source§fn from_str(
version_str: &str,
) -> Result<HttpVersion, <HttpVersion as FromStr>::Err>
fn from_str( version_str: &str, ) -> Result<HttpVersion, <HttpVersion as FromStr>::Err>
Converts a string slice into an HttpVersion variant.
This method attempts to parse the input string into a known HttpVersion variant.
If the string does not match any known version, it returns an Unknown variant
containing the original string.
§Arguments
&str- The string slice to convert.
§Returns
A Result containing the HttpVersion variant if successful, or Self::Err on failure.
Source§impl PartialEq for HttpVersion
impl PartialEq for HttpVersion
Source§impl Serialize for HttpVersion
impl Serialize for HttpVersion
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for HttpVersion
Auto Trait Implementations§
impl Freeze for HttpVersion
impl RefUnwindSafe for HttpVersion
impl Send for HttpVersion
impl Sync for HttpVersion
impl Unpin for HttpVersion
impl UnsafeUnpin for HttpVersion
impl UnwindSafe for HttpVersion
Blanket Implementations§
impl<T> AnySend for T
impl<T> AnySendClone for T
impl<T> AnySendSync for T
impl<T> AnySendSyncClone for T
impl<T> AnySync for T
impl<T> AnySyncClone for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.