pub struct StreamId(/* private fields */);
Expand description
Streams are identified within a connection by a numeric value, referred to as the stream ID.
A stream ID is a 62-bit integer (0 to 262-1) that is unique for all streams on a connection.
Stream IDs are encoded as VarInt
.
A QUIC endpoint MUST NOT reuse a stream ID within a connection.
There are four types of streams in QUIC, divided according to the role and direction of the stream. See Stream ID Types of QUIC for more details.
Implementations§
Source§impl StreamId
impl StreamId
Sourcepub fn new(role: Role, dir: Dir, id: u64) -> StreamId
pub fn new(role: Role, dir: Dir, id: u64) -> StreamId
Create a new stream ID with the given role, direction, and ID.
It is prohibited to directly create a StreamId from external sources. StreamId can only be allocated incrementally by proactively creating new streams locally. or accepting new streams opened by peer.
Sourcepub fn id(&self) -> u64
pub fn id(&self) -> u64
Get the actual ID of this stream, removing the lowest 2 bits for direction and role.
Sourcepub fn encoding_size(&self) -> usize
pub fn encoding_size(&self) -> usize
Return the encoding size of this stream ID.