Skip to content

Commit

Permalink
Add Sequence derive for streaming event type for enumeration
Browse files Browse the repository at this point in the history
  • Loading branch information
jonlamb-gh committed Jun 7, 2024
1 parent 0e37fcc commit 8bc075d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "trace-recorder-parser"
version = "0.12.0"
version = "0.13.0"
edition = "2021"
authors = ["Jon Lamb <[email protected]>"]
description = "A Rust library to parse Percepio's TraceRecorder data"
Expand All @@ -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]
Expand Down
4 changes: 3 additions & 1 deletion src/streaming/event/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -405,6 +406,7 @@ impl UserEventChannel {
LowerHex,
UpperHex,
Deref,
Sequence,
)]
#[display(fmt = "{_0}")]
pub struct UserEventArgRecordCount(pub u8);
Expand Down

0 comments on commit 8bc075d

Please sign in to comment.