pub struct Http2Frame {
pub length: u32,
pub frame_type: Http2FrameType,
pub flags: u8,
pub stream_id: u32,
pub payload_offset: usize,
pub total_size: usize,
}Expand description
A parsed HTTP/2 frame, holding the frame header fields and a reference to where the payload resides in the original buffer.
Fields§
§length: u3224-bit payload length.
frame_type: Http2FrameTypeFrame type.
flags: u8Flags byte.
stream_id: u3231-bit stream identifier (R bit masked out).
payload_offset: usizeByte offset in the original buffer where the payload starts.
total_size: usizeTotal frame size in bytes: 9 (header) + payload length.
Implementations§
Source§impl Http2Frame
impl Http2Frame
Sourcepub fn parse_at(buf: &[u8], offset: usize) -> Option<Self>
pub fn parse_at(buf: &[u8], offset: usize) -> Option<Self>
Parse one HTTP/2 frame from buf starting at offset.
Returns None if there are not enough bytes for the frame header
or if the payload extends beyond the buffer.
Sourcepub fn payload<'a>(&self, buf: &'a [u8]) -> &'a [u8] ⓘ
pub fn payload<'a>(&self, buf: &'a [u8]) -> &'a [u8] ⓘ
Get the payload bytes from the original buffer.
Sourcepub fn is_end_stream(&self) -> bool
pub fn is_end_stream(&self) -> bool
Returns true if the END_STREAM flag is set.
Valid for DATA and HEADERS frames.
Sourcepub fn is_end_headers(&self) -> bool
pub fn is_end_headers(&self) -> bool
Returns true if the END_HEADERS flag is set.
Valid for HEADERS, PUSH_PROMISE, and CONTINUATION frames.
Sourcepub fn is_ack(&self) -> bool
pub fn is_ack(&self) -> bool
Returns true if the ACK flag is set.
Valid for SETTINGS and PING frames.
Sourcepub fn is_padded(&self) -> bool
pub fn is_padded(&self) -> bool
Returns true if the PADDED flag is set.
Valid for DATA, HEADERS, and PUSH_PROMISE frames.
Sourcepub fn has_priority(&self) -> bool
pub fn has_priority(&self) -> bool
Returns true if the PRIORITY flag is set.
Valid for HEADERS frames.
Trait Implementations§
Source§impl Clone for Http2Frame
impl Clone for Http2Frame
Source§fn clone(&self) -> Http2Frame
fn clone(&self) -> Http2Frame
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more