pub struct StreamHeader {
pub stream_id: u16,
pub flags: StreamFlags,
pub reserved: u8,
pub length: u32,
}Expand description
Stream header for multiplexing
Format (8 bytes):
- stream_id: u16 (0 = control, 1-65535 = data streams)
- flags: u8 (FIN=1, RST=2, ACK=4, SYN=8)
- reserved: u8
- length: u32 (payload length, big-endian)
Fields§
§stream_id: u16Stream ID (0 = control, 1-65535 = data streams)
flags: StreamFlagsFlags: FIN=1, RST=2, ACK=4, SYN=8
reserved: u8Reserved for future use
length: u32Payload length
Implementations§
Source§impl StreamHeader
impl StreamHeader
Sourcepub const CONTROL_STREAM: u16 = 0
pub const CONTROL_STREAM: u16 = 0
Control stream ID
Sourcepub const MAX_STREAM_ID: u16 = 65535
pub const MAX_STREAM_ID: u16 = 65535
Maximum stream ID
Sourcepub fn new(stream_id: u16, flags: StreamFlags, length: u32) -> Self
pub fn new(stream_id: u16, flags: StreamFlags, length: u32) -> Self
Create a new stream header
Sourcepub fn is_control(&self) -> bool
pub fn is_control(&self) -> bool
Check if this is a control stream message
Sourcepub fn decode_from(src: &mut BytesMut) -> Option<Self>
pub fn decode_from(src: &mut BytesMut) -> Option<Self>
Decode header from BytesMut, advancing the buffer
Sourcepub fn frame_size(&self) -> usize
pub fn frame_size(&self) -> usize
Total frame size (header + payload)
Trait Implementations§
Source§impl Clone for StreamHeader
impl Clone for StreamHeader
Source§fn clone(&self) -> StreamHeader
fn clone(&self) -> StreamHeader
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 moreimpl Copy for StreamHeader
Source§impl Debug for StreamHeader
impl Debug for StreamHeader
impl Eq for StreamHeader
Source§impl PartialEq for StreamHeader
impl PartialEq for StreamHeader
Source§fn eq(&self, other: &StreamHeader) -> bool
fn eq(&self, other: &StreamHeader) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for StreamHeader
Auto Trait Implementations§
impl Freeze for StreamHeader
impl RefUnwindSafe for StreamHeader
impl Send for StreamHeader
impl Sync for StreamHeader
impl Unpin for StreamHeader
impl UnsafeUnpin for StreamHeader
impl UnwindSafe for StreamHeader
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