pub struct Http2FrameBuilder { /* private fields */ }Expand description
Builder for a single HTTP/2 frame.
§Example
use stackforge_core::layer::http2::builder::Http2FrameBuilder;
use stackforge_core::layer::http2::frames::Http2FrameType;
let frame = Http2FrameBuilder::settings_ack().build();
assert_eq!(frame.len(), 9); // 9-byte header, empty payloadImplementations§
Source§impl Http2FrameBuilder
impl Http2FrameBuilder
Sourcepub fn new(frame_type: Http2FrameType) -> Self
pub fn new(frame_type: Http2FrameType) -> Self
Create a new frame builder for the given frame type.
Sourcepub fn end_stream(self) -> Self
pub fn end_stream(self) -> Self
Set the END_STREAM flag (0x1).
Used with DATA and HEADERS frames.
Sourcepub fn end_headers(self) -> Self
pub fn end_headers(self) -> Self
Set the END_HEADERS flag (0x4).
Used with HEADERS, PUSH_PROMISE, and CONTINUATION frames.
Sourcepub fn settings_ack() -> Self
pub fn settings_ack() -> Self
Create a SETTINGS ACK frame (stream 0, ACK flag set).
Sourcepub fn settings_with_params(params: &[(u16, u32)]) -> Self
pub fn settings_with_params(params: &[(u16, u32)]) -> Self
Create a SETTINGS frame with parameters.
Each entry is (settings_id, value). The payload is 6 bytes per entry.
Sourcepub fn goaway(last_stream: u32, error_code: u32) -> Self
pub fn goaway(last_stream: u32, error_code: u32) -> Self
Create a GOAWAY frame.
§Arguments
last_stream: the last stream ID processederror_code: the error code (seeframes::error_codes)
Sourcepub fn window_update(increment: u32, stream_id: u32) -> Self
pub fn window_update(increment: u32, stream_id: u32) -> Self
Create a WINDOW_UPDATE frame.
§Arguments
increment: window size increment (1-2^31-1)stream_id: stream ID (0 for connection-level)
Sourcepub fn rst_stream(stream_id: u32, error_code: u32) -> Self
pub fn rst_stream(stream_id: u32, error_code: u32) -> Self
Sourcepub fn headers_frame(stream_id: u32, hpack_data: Vec<u8>) -> Self
pub fn headers_frame(stream_id: u32, hpack_data: Vec<u8>) -> Self
Create a HEADERS frame carrying HPACK-encoded header data.
Sets END_HEADERS by default. Use .flags() to override.
Sourcepub fn headers_frame_final(stream_id: u32, hpack_data: Vec<u8>) -> Self
pub fn headers_frame_final(stream_id: u32, hpack_data: Vec<u8>) -> Self
Create a HEADERS frame with END_STREAM + END_HEADERS flags set.
Sourcepub fn data_frame(stream_id: u32, data: Vec<u8>) -> Self
pub fn data_frame(stream_id: u32, data: Vec<u8>) -> Self
Create a DATA frame.
Sourcepub fn data_frame_final(stream_id: u32, data: Vec<u8>) -> Self
pub fn data_frame_final(stream_id: u32, data: Vec<u8>) -> Self
Create a DATA frame with END_STREAM set.
Sourcepub fn continuation(stream_id: u32, hpack_data: Vec<u8>) -> Self
pub fn continuation(stream_id: u32, hpack_data: Vec<u8>) -> Self
Create a CONTINUATION frame.
Sourcepub fn continuation_final(stream_id: u32, hpack_data: Vec<u8>) -> Self
pub fn continuation_final(stream_id: u32, hpack_data: Vec<u8>) -> Self
Create a CONTINUATION frame with END_HEADERS set.
Sourcepub fn priority_frame(
stream_id: u32,
exclusive: bool,
stream_dep: u32,
weight: u8,
) -> Self
pub fn priority_frame( stream_id: u32, exclusive: bool, stream_dep: u32, weight: u8, ) -> Self
Create a PRIORITY frame.
§Arguments
stream_id: the stream being prioritizedexclusive: exclusive dependency flagstream_dep: stream dependencyweight: priority weight (0-255, actual weight = weight + 1)
Trait Implementations§
Source§impl Clone for Http2FrameBuilder
impl Clone for Http2FrameBuilder
Source§fn clone(&self) -> Http2FrameBuilder
fn clone(&self) -> Http2FrameBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Http2FrameBuilder
impl Debug for Http2FrameBuilder
Source§impl IntoLayerStackEntry for Http2FrameBuilder
impl IntoLayerStackEntry for Http2FrameBuilder
fn into_layer_stack_entry(self) -> LayerStackEntry
Auto Trait Implementations§
impl Freeze for Http2FrameBuilder
impl RefUnwindSafe for Http2FrameBuilder
impl Send for Http2FrameBuilder
impl Sync for Http2FrameBuilder
impl Unpin for Http2FrameBuilder
impl UnsafeUnpin for Http2FrameBuilder
impl UnwindSafe for Http2FrameBuilder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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