feather_runtime/http/
mod.rs

1mod request;
2mod response;
3use std::ops::Deref;
4
5pub use request::Request;
6pub use response::Response;
7
8#[derive(Debug, Clone)]
9pub enum ConnectionState {
10    KeepAlive,
11    Close,
12}
13
14impl ConnectionState {
15    pub fn parse(string: &str) -> Option<ConnectionState> {
16        let string = string.to_lowercase();
17        match string.as_str() {
18            "close" => Some(ConnectionState::Close),
19            "keep-alive" => Some(ConnectionState::KeepAlive),
20            _ => None,
21        }
22    }
23}
24
25impl Deref for ConnectionState {
26    type Target = str;
27
28    fn deref(&self) -> &Self::Target {
29        match self {
30            Self::KeepAlive => return "keep-alive",
31            Self::Close => return "close",
32        }
33    }
34}