pub enum ConnectionType {
KeepAlive,
Close,
Upgrade,
}
Expand description
Connection type
Variants§
Implementations§
Source§impl ConnectionType
impl ConnectionType
Sourcepub fn resolve(
headers_connection_type: Option<ConnectionType>,
carry_over_connection_type: Option<ConnectionType>,
http11: bool,
) -> Result<Self, HeadersMismatchError>
pub fn resolve( headers_connection_type: Option<ConnectionType>, carry_over_connection_type: Option<ConnectionType>, http11: bool, ) -> Result<Self, HeadersMismatchError>
Resolve the connection type
Resolution is based on:
- The connection type found in the headers, if any
- (if the above is missing) based on the carry-over connection type, if any
- (if the above is missing) based on the HTTP version
Parameters:
headers_connection_type
: The connection type found in the headers, if anycarry_over_connection_type
: The carry-over connection type (i.e. if this is a response, thecarry_over_connection_type
is the connection type of the request)http11
: Whether the HTTP protocol is 1.1
Sourcepub fn from_header(name: &str, value: &str) -> Option<Self>
pub fn from_header(name: &str, value: &str) -> Option<Self>
Create a connection type from a header
If the header is not a Connection
header, this method returns None
Sourcepub fn from_headers<'a, H>(headers: H) -> Option<Self>
pub fn from_headers<'a, H>(headers: H) -> Option<Self>
Create a connection type from headers
If multiple Connection
headers are found, this method logs a warning and returns the last one
If no Connection
headers are found, this method returns None
Sourcepub fn raw_header(&self) -> (&str, &[u8])
pub fn raw_header(&self) -> (&str, &[u8])
Create a raw header from the connection type
Trait Implementations§
Source§impl Clone for ConnectionType
impl Clone for ConnectionType
Source§fn clone(&self) -> ConnectionType
fn clone(&self) -> ConnectionType
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ConnectionType
impl Debug for ConnectionType
Source§impl Display for ConnectionType
impl Display for ConnectionType
Source§impl Hash for ConnectionType
impl Hash for ConnectionType
Source§impl PartialEq for ConnectionType
impl PartialEq for ConnectionType
impl Copy for ConnectionType
impl Eq for ConnectionType
impl StructuralPartialEq for ConnectionType
Auto Trait Implementations§
impl Freeze for ConnectionType
impl RefUnwindSafe for ConnectionType
impl Send for ConnectionType
impl Sync for ConnectionType
impl Unpin for ConnectionType
impl UnwindSafe for ConnectionType
Blanket Implementations§
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
Mutably borrows from an owned value. Read more