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