pub struct Http2Frame {
pub frame_type: Http2FrameType,
pub stream_id: u32,
pub flags: u8,
pub payload: Vec<u8>,
pub length: u32,
}Fields§
§frame_type: Http2FrameType§stream_id: u32§flags: u8§payload: Vec<u8>§length: u32Implementations§
Source§impl Http2Frame
impl Http2Frame
Sourcepub fn new(
frame_type_byte: u8,
flags: u8,
stream_id: u32,
payload: Vec<u8>,
) -> Self
pub fn new( frame_type_byte: u8, flags: u8, stream_id: u32, payload: Vec<u8>, ) -> Self
Creates a new HTTP/2 frame
§Parameters
frame_type_byte: Raw frame type byte (0x0-0x9 for standard types)flags: Frame flags bytestream_id: Stream identifierpayload: Frame payload data
§Example
use huginn_net_http::Http2Frame;
// Create a SETTINGS frame (type 0x4)
let frame = Http2Frame::new(0x4, 0x0, 0, vec![0x00, 0x03, 0x00, 0x00, 0x00, 0x64]);Sourcepub fn total_size(&self) -> usize
pub fn total_size(&self) -> usize
Returns the total size of the frame in bytes (header + payload)
HTTP/2 frames have a 9-byte header (3 bytes length + 1 byte type + 1 byte flags + 4 bytes stream ID) followed by the payload.
§Returns
The total size of the frame: 9 bytes (header) + payload length
§Example
use huginn_net_http::Http2Frame;
let frame = Http2Frame::new(0x4, 0x0, 0, vec![0x00, 0x03, 0x00, 0x00, 0x00, 0x64]);
assert_eq!(frame.total_size(), 9 + 6); // 9 bytes header + 6 bytes payloadTrait 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 (const: unstable) · Source§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 UnsafeUnpin for Http2Frame
impl UnwindSafe for Http2Frame
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