1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
use super::*;
#[derive(Hash, PartialEq, Eq, Ord, PartialOrd)]
pub struct OptionKey<T>(pub OptionNumber, core::marker::PhantomData<*const T>);
impl<T> OptionKey<T> {
pub const fn new(n: OptionNumber) -> OptionKey<T> {
OptionKey(n, core::marker::PhantomData)
}
}
impl<T> Copy for OptionKey<T> {}
impl<T> Clone for OptionKey<T> {
fn clone(&self) -> Self {
OptionKey(self.0, core::marker::PhantomData)
}
}
unsafe impl<T> Send for OptionKey<T> {}
impl<T> core::fmt::Debug for OptionKey<T> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{:?}", self.0)
}
}
impl<T> core::ops::Deref for OptionKey<T> {
type Target = OptionNumber;
fn deref(&self) -> &Self::Target {
&self.0
}
}
pub const IF_MATCH: OptionKey<ETag> = OptionKey::new(OptionNumber::IF_MATCH);
pub const URI_HOST: OptionKey<&str> = OptionKey::new(OptionNumber::URI_HOST);
pub const ETAG: OptionKey<ETag> = OptionKey::new(OptionNumber::ETAG);
pub const IF_NONE_MATCH: OptionKey<()> = OptionKey::new(OptionNumber::IF_NONE_MATCH);
pub const OBSERVE: OptionKey<u32> = OptionKey::new(OptionNumber::OBSERVE);
pub const URI_PORT: OptionKey<u16> = OptionKey::new(OptionNumber::URI_PORT);
pub const LOCATION_PATH: OptionKey<&str> = OptionKey::new(OptionNumber::LOCATION_PATH);
pub const OSCORE: OptionKey<&[u8]> = OptionKey::new(OptionNumber::OSCORE);
pub const URI_PATH: OptionKey<&str> = OptionKey::new(OptionNumber::URI_PATH);
pub const CONTENT_FORMAT: OptionKey<ContentFormat> = OptionKey::new(OptionNumber::CONTENT_FORMAT);
pub const MAX_AGE: OptionKey<u32> = OptionKey::new(OptionNumber::MAX_AGE);
pub const URI_QUERY: OptionKey<&str> = OptionKey::new(OptionNumber::URI_QUERY);
pub const ACCEPT: OptionKey<ContentFormat> = OptionKey::new(OptionNumber::ACCEPT);
pub const LOCATION_QUERY: OptionKey<&str> = OptionKey::new(OptionNumber::LOCATION_QUERY);
pub const BLOCK2: OptionKey<BlockInfo> = OptionKey::new(OptionNumber::BLOCK2);
pub const BLOCK1: OptionKey<BlockInfo> = OptionKey::new(OptionNumber::BLOCK1);
pub const SIZE2: OptionKey<u32> = OptionKey::new(OptionNumber::SIZE2);
pub const PROXY_URI: OptionKey<&str> = OptionKey::new(OptionNumber::PROXY_URI);
pub const PROXY_SCHEME: OptionKey<&str> = OptionKey::new(OptionNumber::PROXY_SCHEME);
pub const SIZE1: OptionKey<u32> = OptionKey::new(OptionNumber::SIZE1);