monoio_netreq/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
extern crate monoio_transports_netreq_fork as monoio_transports;

#[cfg(not(feature = "hyper-tls"))]
pub mod http;
mod request;
mod response;
mod error;
#[cfg(any(feature = "hyper", feature = "pool-hyper", feature = "hyper-tls"))]
pub mod hyper;
mod key;

#[derive(Default, Clone, PartialEq, Debug)]
enum Protocol {
    Http1,
    Http2,
    #[default]
    Auto,
}

impl Protocol {
    pub(crate) fn is_protocol_h1(&self) -> bool {
        self.eq(&Protocol::Http1)
    }

    pub(crate) fn is_protocol_h2(&self) -> bool {
        self.eq(&Protocol::Http2)
    }

    #[allow(dead_code)]
    pub(crate) fn is_protocol_auto(&self) -> bool {
        self.eq(&Protocol::Auto)
    }
}