Skip to content

Commit edb5cd5

Browse files
authored
Add standard Rust attributes. (#24)
Signed-off-by: Yaroslav Skopets <yaroslav@tetrate.io>
1 parent 32a71e6 commit edb5cd5

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/types.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub type NewStreamContext = fn(context_id: u32, root_context_id: u32) -> Box<dyn
1919
pub type NewHttpContext = fn(context_id: u32, root_context_id: u32) -> Box<dyn HttpContext>;
2020

2121
#[repr(u32)]
22-
#[derive(Debug)]
22+
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
2323
pub enum LogLevel {
2424
Trace = 0,
2525
Debug = 1,
@@ -30,14 +30,16 @@ pub enum LogLevel {
3030
}
3131

3232
#[repr(u32)]
33-
#[derive(Debug)]
33+
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
34+
#[non_exhaustive]
3435
pub enum Action {
3536
Continue = 0,
3637
Pause = 1,
3738
}
3839

3940
#[repr(u32)]
40-
#[derive(Debug)]
41+
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
42+
#[non_exhaustive]
4143
pub enum Status {
4244
Ok = 0,
4345
NotFound = 1,
@@ -49,14 +51,16 @@ pub enum Status {
4951
}
5052

5153
#[repr(u32)]
52-
#[derive(Debug)]
54+
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
55+
#[non_exhaustive]
5356
pub enum ContextType {
5457
HttpContext = 0,
5558
StreamContext = 1,
5659
}
5760

5861
#[repr(u32)]
59-
#[derive(Debug)]
62+
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
63+
#[non_exhaustive]
6064
pub enum BufferType {
6165
HttpRequestBody = 0,
6266
HttpResponseBody = 1,
@@ -67,7 +71,8 @@ pub enum BufferType {
6771
}
6872

6973
#[repr(u32)]
70-
#[derive(Debug)]
74+
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
75+
#[non_exhaustive]
7176
pub enum MapType {
7277
HttpRequestHeaders = 0,
7378
HttpRequestTrailers = 1,
@@ -80,15 +85,17 @@ pub enum MapType {
8085
}
8186

8287
#[repr(u32)]
83-
#[derive(Debug)]
88+
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
89+
#[non_exhaustive]
8490
pub enum PeerType {
8591
Unknown = 0,
8692
Local = 1,
8793
Remote = 2,
8894
}
8995

9096
#[repr(u32)]
91-
#[derive(Debug)]
97+
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
98+
#[non_exhaustive]
9299
pub enum MetricType {
93100
Counter = 0,
94101
Gauge = 1,

0 commit comments

Comments
 (0)