From 8bc075d348c4c745c53ef3c9bdab76296fd7db5c Mon Sep 17 00:00:00 2001 From: Jon Lamb Date: Fri, 7 Jun 2024 04:43:25 -0700 Subject: [PATCH] Add Sequence derive for streaming event type for enumeration --- Cargo.toml | 3 ++- src/streaming/event/mod.rs | 4 +++- src/types.rs | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index df94520..189b818 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "trace-recorder-parser" -version = "0.12.0" +version = "0.13.0" edition = "2021" authors = ["Jon Lamb "] description = "A Rust library to parse Percepio's TraceRecorder data" @@ -15,6 +15,7 @@ thiserror = "1.0" derive_more = "0.99" ordered-float = "4.2" byteordered = "0.6" +enum-iterator = "2.1" # For the examples [dev-dependencies] diff --git a/src/streaming/event/mod.rs b/src/streaming/event/mod.rs index a1caeda..6394f7b 100644 --- a/src/streaming/event/mod.rs +++ b/src/streaming/event/mod.rs @@ -1,6 +1,7 @@ use crate::time::Timestamp; use crate::types::UserEventArgRecordCount; use derive_more::{Binary, Deref, Display, From, Into, LowerHex, Octal, UpperHex}; +use enum_iterator::Sequence; pub use base::BaseEvent; pub use object_name::ObjectNameEvent; @@ -141,12 +142,13 @@ impl EventCode { Octal, LowerHex, UpperHex, + Sequence, )] #[display(fmt = "{_0:X}")] pub struct EventId(pub u16); /// Event types for streaming mode -#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Display)] +#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Display, Sequence)] pub enum EventType { #[display(fmt = "NULL")] Null, diff --git a/src/types.rs b/src/types.rs index 5f63c98..dbe24c2 100644 --- a/src/types.rs +++ b/src/types.rs @@ -2,6 +2,7 @@ use byteordered::ByteOrdered; use derive_more::{Binary, Deref, Display, From, Into, LowerHex, Octal, UpperHex}; +use enum_iterator::Sequence; use ordered_float::OrderedFloat; use std::fmt::Write as _; use std::io; @@ -405,6 +406,7 @@ impl UserEventChannel { LowerHex, UpperHex, Deref, + Sequence, )] #[display(fmt = "{_0}")] pub struct UserEventArgRecordCount(pub u8);