From edb5cd54f94d2bd18eea8ea59ae04225c693b0a7 Mon Sep 17 00:00:00 2001 From: Yaroslav Skopets Date: Thu, 1 Jul 2021 23:52:43 +0200 Subject: [PATCH] Add standard Rust attributes. (#24) Signed-off-by: Yaroslav Skopets --- src/types.rs | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/types.rs b/src/types.rs index b1e6d55a..f5aa7c27 100644 --- a/src/types.rs +++ b/src/types.rs @@ -19,7 +19,7 @@ pub type NewStreamContext = fn(context_id: u32, root_context_id: u32) -> Box Box; #[repr(u32)] -#[derive(Debug)] +#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] pub enum LogLevel { Trace = 0, Debug = 1, @@ -30,14 +30,16 @@ pub enum LogLevel { } #[repr(u32)] -#[derive(Debug)] +#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] +#[non_exhaustive] pub enum Action { Continue = 0, Pause = 1, } #[repr(u32)] -#[derive(Debug)] +#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] +#[non_exhaustive] pub enum Status { Ok = 0, NotFound = 1, @@ -49,14 +51,16 @@ pub enum Status { } #[repr(u32)] -#[derive(Debug)] +#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] +#[non_exhaustive] pub enum ContextType { HttpContext = 0, StreamContext = 1, } #[repr(u32)] -#[derive(Debug)] +#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] +#[non_exhaustive] pub enum BufferType { HttpRequestBody = 0, HttpResponseBody = 1, @@ -67,7 +71,8 @@ pub enum BufferType { } #[repr(u32)] -#[derive(Debug)] +#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] +#[non_exhaustive] pub enum MapType { HttpRequestHeaders = 0, HttpRequestTrailers = 1, @@ -80,7 +85,8 @@ pub enum MapType { } #[repr(u32)] -#[derive(Debug)] +#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] +#[non_exhaustive] pub enum PeerType { Unknown = 0, Local = 1, @@ -88,7 +94,8 @@ pub enum PeerType { } #[repr(u32)] -#[derive(Debug)] +#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] +#[non_exhaustive] pub enum MetricType { Counter = 0, Gauge = 1,