Struct solicit::http::frame::headers::StreamDependency [] [src]

pub struct StreamDependency {
    pub stream_id: StreamId,
    pub weight: u8,
    pub is_exclusive: bool,
}

The struct represents the dependency information that can be attached to a stream and sent within a HEADERS frame (one with the Priority flag set).

Fields

stream_id

The ID of the stream that a particular stream depends on

weight

The weight for the stream. The value exposed (and set) here is always in the range [0, 255], instead of [1, 256] (as defined in section 5.3.2.) so that the value fits into a u8.

is_exclusive

A flag indicating whether the stream dependency is exclusive.

Methods

impl StreamDependency

fn new(stream_id: StreamId, weight: u8, is_exclusive: bool) -> StreamDependency

Creates a new StreamDependency with the given stream ID, weight, and exclusivity.

fn parse(buf: &[u8]) -> StreamDependency

Parses the first 5 bytes in the buffer as a StreamDependency. (Each 5-byte sequence is always decodable into a stream dependency structure).

Panics

If the given buffer has less than 5 elements, the method will panic.

fn serialize(&self) -> [u8; 5]

Serializes the StreamDependency into a 5-byte buffer representing the dependency description, as described in section 6.2. of the HTTP/2 spec:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-------------+-----------------------------------------------+
|E|                 Stream Dependency  (31)                     |
+-+-------------+-----------------------------------------------+
|  Weight  (8)  |
+-+-------------+-----------------------------------------------+

Where "E" is set if the dependency is exclusive.

Trait Implementations

Derived Implementations

impl PartialEq for StreamDependency

fn eq(&self, __arg_0: &StreamDependency) -> bool

fn ne(&self, __arg_0: &StreamDependency) -> bool

impl Debug for StreamDependency

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl Clone for StreamDependency

fn clone(&self) -> StreamDependency

fn clone_from(&mut self, source: &Self)