Context

Struct Context 

Source
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>

Source

pub fn decode_head<const READ_BUF_LIMIT: usize>( &mut self, buf: &mut BytesMut, ) -> Result<Option<(Request<RequestExt<()>>, TransferCoding)>, ProtoError>

Source

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>

Source

pub fn new(date: &'a D) -> Self

Context is constructed with reference of certain type that impl DateTime trait.

Source

pub fn with_addr(addr: SocketAddr, date: &'a D) -> Self

Context is constructed with SocketAddr and reference of certain type that impl DateTime trait.

Source

pub fn date(&self) -> &D

Get Date type from Context.

Source

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.

Source

pub fn take_extensions(&mut self) -> Extensions

Take ownership of Extensions stored in Context.

Source

pub fn replace_headers(&mut self, headers: HeaderMap)

Replace a new HeaderMap in current Context.

Source

pub fn replace_extensions(&mut self, extensions: Extensions)

Replace a new Extensions in current Context.

Source

pub fn reset(&mut self)

Reset Context’s state to partial default state.

Source

pub fn set_expect_header(&mut self)

Set Context’s state to EXPECT header received.

Source

pub fn set_connect_method(&mut self)

Set Context’s state to CONNECT method received.

Source

pub fn set_head_method(&mut self)

Set Context’s state to HEAD method received.

Source

pub fn set_close(&mut self)

Set Context’s state to Close.

Source

pub fn remove_close(&mut self)

Remove Context’s Close state.

Source

pub const fn is_expect_header(&self) -> bool

Get expect header state.

Source

pub const fn is_connect_method(&self) -> bool

Get CONNECT method state.

Source

pub const fn is_head_method(&self) -> bool

Get HEAD method state.

Source

pub const fn is_connection_closed(&self) -> bool

Return true if connection type is Connection: Close.

Source

pub fn socket_addr(&self) -> &SocketAddr

Get remote socket address context associated with.

Source§

impl<D, const MAX_HEADERS: usize> Context<'_, D, MAX_HEADERS>
where D: DateTime,

Source

pub fn encode_head<B, W>( &mut self, parts: Parts, body: &B, buf: &mut W, ) -> Result<TransferCoding, ProtoError>
where B: Stream, W: H1BufWrite,

Source§

impl<D, const MAX_HEADERS: usize> Context<'_, D, MAX_HEADERS>
where D: DateTime,

Source

pub fn encode_headers( &mut self, headers: &mut HeaderMap, size: BodySize, buf: &mut BytesMut, skip_ct_te: bool, ) -> Result<TransferCoding, ProtoError>

Auto Trait Implementations§

§

impl<'a, D, const HEADER_LIMIT: usize> Freeze for Context<'a, D, HEADER_LIMIT>

§

impl<'a, D, const HEADER_LIMIT: usize> !RefUnwindSafe for Context<'a, D, HEADER_LIMIT>

§

impl<'a, D, const HEADER_LIMIT: usize> Send for Context<'a, D, HEADER_LIMIT>
where D: Sync,

§

impl<'a, D, const HEADER_LIMIT: usize> Sync for Context<'a, D, HEADER_LIMIT>
where D: Sync,

§

impl<'a, D, const HEADER_LIMIT: usize> Unpin for Context<'a, D, HEADER_LIMIT>

§

impl<'a, D, const HEADER_LIMIT: usize> !UnwindSafe for Context<'a, D, HEADER_LIMIT>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more