pub struct HpackEncoder { /* private fields */ }Expand description
HPACK encoder with custom pseudo-header ordering.
Implementations§
Source§impl HpackEncoder
impl HpackEncoder
Sourcepub fn new(pseudo_order: PseudoHeaderOrder) -> Self
pub fn new(pseudo_order: PseudoHeaderOrder) -> Self
Create a new encoder with the specified pseudo-header order.
Sourcepub fn set_max_table_size(&mut self, size: usize)
pub fn set_max_table_size(&mut self, size: usize)
Set the dynamic table size.
Sourcepub fn encode_request(
&mut self,
method: &str,
scheme: &str,
authority: &str,
path: &str,
headers: &[(String, String)],
) -> Bytes
pub fn encode_request( &mut self, method: &str, scheme: &str, authority: &str, path: &str, headers: &[(String, String)], ) -> Bytes
Encode headers for an HTTP/2 request.
Pseudo-headers are ordered according to the configured order. Regular headers follow in the order provided.
Sourcepub fn chunk_encoded(
encoded: Bytes,
max_frame_size: usize,
) -> (Bytes, Vec<Bytes>)
pub fn chunk_encoded( encoded: Bytes, max_frame_size: usize, ) -> (Bytes, Vec<Bytes>)
Split an encoded header block into chunks if it exceeds max_frame_size. Returns (first_chunk, remaining_chunks).
This is used when header blocks exceed MAX_FRAME_SIZE and must be split across HEADERS + CONTINUATION frames per RFC 9113 Section 6.10.
Use this after calling encode_request() to chunk the result if needed.
Auto Trait Implementations§
impl Freeze for HpackEncoder
impl RefUnwindSafe for HpackEncoder
impl Send for HpackEncoder
impl Sync for HpackEncoder
impl Unpin for HpackEncoder
impl UnsafeUnpin for HpackEncoder
impl UnwindSafe for HpackEncoder
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more