pub struct Http2Frame {
pub length: u32,
pub frame_type: FrameType,
pub flags: u8,
pub stream_id: u32,
pub payload: Vec<u8>,
}Expand description
HTTP/2 frame header + payload.
Fields§
§length: u32Length of the payload (24-bit).
frame_type: FrameTypeFrame type.
flags: u8Frame flags.
stream_id: u32Stream identifier (31-bit).
payload: Vec<u8>Frame payload.
Implementations§
Source§impl Http2Frame
impl Http2Frame
Sourcepub const HEADER_SIZE: usize = 9usize
pub const HEADER_SIZE: usize = 9usize
HTTP/2 frame header size in bytes.
Sourcepub fn parse(data: &[u8]) -> Option<(Self, usize)>
pub fn parse(data: &[u8]) -> Option<(Self, usize)>
Parse an HTTP/2 frame from raw bytes.
Returns the frame and the number of bytes consumed, or None if the buffer is too small.
Sourcepub fn settings_ack() -> Self
pub fn settings_ack() -> Self
Create a SETTINGS ACK frame.
Sourcepub fn window_update(stream_id: u32, increment: u32) -> Self
pub fn window_update(stream_id: u32, increment: u32) -> Self
Create a WINDOW_UPDATE frame.
Sourcepub fn is_end_stream(&self) -> bool
pub fn is_end_stream(&self) -> bool
Check if END_STREAM flag is set.
Sourcepub fn is_end_headers(&self) -> bool
pub fn is_end_headers(&self) -> bool
Check if END_HEADERS flag is set (for HEADERS frames).
Trait Implementations§
Source§impl Clone for Http2Frame
impl Clone for Http2Frame
Source§fn clone(&self) -> Http2Frame
fn clone(&self) -> Http2Frame
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Http2Frame
impl RefUnwindSafe for Http2Frame
impl Send for Http2Frame
impl Sync for Http2Frame
impl Unpin for Http2Frame
impl UnwindSafe for Http2Frame
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)