net_wire/http2/
priority.rs1#[derive(Clone, Copy, Debug, Eq, PartialEq)]
3pub struct Http2Priority {
4 raw_dependency: u32,
5 weight: u8,
6}
7
8impl Http2Priority {
9 pub const fn new(raw_dependency: u32, weight: u8) -> Self {
11 Self {
12 raw_dependency,
13 weight,
14 }
15 }
16
17 pub(super) fn parse(bytes: &[u8]) -> Self {
18 Self {
19 raw_dependency: u32::from_be_bytes([bytes[0], bytes[1], bytes[2], bytes[3]]),
20 weight: bytes[4],
21 }
22 }
23
24 pub const fn is_exclusive(self) -> bool {
26 self.raw_dependency & 0x8000_0000 != 0
27 }
28
29 pub const fn raw_dependency(self) -> u32 {
31 self.raw_dependency
32 }
33
34 pub const fn dependency(self) -> u32 {
36 self.raw_dependency & 0x7fff_ffff
37 }
38
39 pub const fn weight(self) -> u8 {
41 self.weight
42 }
43}