pub struct Context<'a, D, const HEADER_LIMIT: usize> { /* private fields */ }Expand description
Context is connection specific struct contain states for processing.
Implementations§
Source§impl<D, const MAX_HEADERS: usize> Context<'_, D, MAX_HEADERS>
impl<D, const MAX_HEADERS: usize> Context<'_, D, MAX_HEADERS>
pub fn decode_head<const READ_BUF_LIMIT: usize>( &mut self, buf: &mut BytesMut, ) -> Result<Option<(Request<RequestExt<()>>, TransferCoding)>, ProtoError>
pub fn try_write_header( &mut self, headers: &mut HeaderMap, decoder: &mut TransferCoding, idx: &HeaderIndex, slice: &Bytes, version: Version, ) -> Result<(), ProtoError>
Source§impl<'a, D, const HEADER_LIMIT: usize> Context<'a, D, HEADER_LIMIT>
impl<'a, D, const HEADER_LIMIT: usize> Context<'a, D, HEADER_LIMIT>
Sourcepub fn new(date: &'a D) -> Self
pub fn new(date: &'a D) -> Self
Context is constructed with reference of certain type that impl DateTime trait.
Sourcepub fn with_addr(addr: SocketAddr, date: &'a D) -> Self
pub fn with_addr(addr: SocketAddr, date: &'a D) -> Self
Context is constructed with SocketAddr and reference of certain type that impl DateTime trait.
Sourcepub fn take_headers(&mut self) -> HeaderMap
pub fn take_headers(&mut self) -> HeaderMap
Take ownership of HeaderMap stored in Context.
When Context does not have one a new HeaderMap is constructed.
Sourcepub fn take_extensions(&mut self) -> Extensions
pub fn take_extensions(&mut self) -> Extensions
Take ownership of Extensions stored in Context.
Sourcepub fn replace_headers(&mut self, headers: HeaderMap)
pub fn replace_headers(&mut self, headers: HeaderMap)
Replace a new HeaderMap in current Context.
Sourcepub fn replace_extensions(&mut self, extensions: Extensions)
pub fn replace_extensions(&mut self, extensions: Extensions)
Replace a new Extensions in current Context.
Sourcepub fn set_expect_header(&mut self)
pub fn set_expect_header(&mut self)
Set Context’s state to EXPECT header received.
Sourcepub fn set_connect_method(&mut self)
pub fn set_connect_method(&mut self)
Set Context’s state to CONNECT method received.
Sourcepub fn set_head_method(&mut self)
pub fn set_head_method(&mut self)
Set Context’s state to HEAD method received.
Sourcepub fn remove_close(&mut self)
pub fn remove_close(&mut self)
Remove Context’s Close state.
Sourcepub const fn is_expect_header(&self) -> bool
pub const fn is_expect_header(&self) -> bool
Get expect header state.
Sourcepub const fn is_connect_method(&self) -> bool
pub const fn is_connect_method(&self) -> bool
Get CONNECT method state.
Sourcepub const fn is_head_method(&self) -> bool
pub const fn is_head_method(&self) -> bool
Get HEAD method state.
Sourcepub const fn is_connection_closed(&self) -> bool
pub const fn is_connection_closed(&self) -> bool
Return true if connection type is Connection: Close.
Sourcepub fn socket_addr(&self) -> &SocketAddr
pub fn socket_addr(&self) -> &SocketAddr
Get remote socket address context associated with.