Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(format): derive Debug, Clone, and Copy traits #11

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added
- This CHANGELOG file that will contain all notable changes to this project ([#2](https://github.com/soehrl/tracing-tape/pull/2/))
- Derive the `Debug`, `Clone`, and `Copy` traits for all structs in the `tracing-tape` crate ([#11](https://github.com/soehrl/tracing-tape/pull/11/))

### Fixed
- Parsing of *SpanExit* records ([#3](https://github.com/soehrl/tracing-tape/pull/3/))
Expand Down
6 changes: 3 additions & 3 deletions tracing-tape/src/record/callsite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use zerocopy::{little_endian, AsBytes, FromBytes, FromZeroes, Unaligned};

use super::{record_kind, RecordHeader};

#[derive(Debug, AsBytes, FromZeroes, FromBytes, Unaligned)]
#[derive(Debug, Clone, Copy, AsBytes, FromZeroes, FromBytes, Unaligned)]
#[repr(transparent)]
pub struct CallsiteInfo(u8);

Expand Down Expand Up @@ -73,7 +73,7 @@ impl CallsiteInfo {
}
}

#[derive(Debug, AsBytes, FromZeroes, FromBytes, Unaligned)]
#[derive(Debug, Clone, Copy, AsBytes, FromZeroes, FromBytes, Unaligned)]
#[repr(C)]
pub struct CallsiteRecord {
pub header: RecordHeader,
Expand Down Expand Up @@ -114,7 +114,7 @@ impl CallsiteRecord {
}
}

#[derive(Debug, AsBytes, FromZeroes, FromBytes, Unaligned)]
#[derive(Debug, Clone, Copy, AsBytes, FromZeroes, FromBytes, Unaligned)]
#[repr(C)]
pub struct CallsiteFieldRecord {
pub header: RecordHeader,
Expand Down
4 changes: 2 additions & 2 deletions tracing-tape/src/record/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use zerocopy::{little_endian, AsBytes, FromBytes, FromZeroes, Unaligned};

use super::{record_kind, RecordHeader};

#[derive(AsBytes, FromZeroes, FromBytes, Unaligned)]
#[derive(Debug, Clone, Copy, AsBytes, FromZeroes, FromBytes, Unaligned)]
#[repr(C)]
pub struct EventRecord {
pub header: RecordHeader,
Expand All @@ -24,7 +24,7 @@ impl EventRecord {
}
}

#[derive(AsBytes, FromZeroes, FromBytes, Unaligned)]
#[derive(Debug, Clone, Copy, AsBytes, FromZeroes, FromBytes, Unaligned)]
#[repr(C)]
pub struct EventValueRecord {
pub header: RecordHeader,
Expand Down
2 changes: 1 addition & 1 deletion tracing-tape/src/record/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub mod record_kind {
pub const SPAN_FOLLOWS: u8 = 0x25;
}

#[derive(Debug, AsBytes, FromBytes, FromZeroes, Unaligned)]
#[derive(Debug, Clone, Copy, AsBytes, FromBytes, FromZeroes, Unaligned)]
#[repr(C)]
pub struct RecordHeader {
pub kind: u8,
Expand Down
12 changes: 6 additions & 6 deletions tracing-tape/src/record/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use zerocopy::{little_endian, AsBytes, FromBytes, FromZeroes, Unaligned};

use super::{record_kind, RecordHeader};

#[derive(AsBytes, FromZeroes, FromBytes, Unaligned)]
#[derive(Debug, Clone, Copy, AsBytes, FromZeroes, FromBytes, Unaligned)]
#[repr(C)]
pub struct SpanOpenRecord {
pub header: RecordHeader,
Expand All @@ -27,7 +27,7 @@ impl SpanOpenRecord {
}
}

#[derive(AsBytes, FromZeroes, FromBytes, Unaligned)]
#[derive(Debug, Clone, Copy, AsBytes, FromZeroes, FromBytes, Unaligned)]
#[repr(C)]
pub struct SpanCloseRecord {
pub header: RecordHeader,
Expand All @@ -48,7 +48,7 @@ impl SpanCloseRecord {
}
}

#[derive(AsBytes, FromZeroes, FromBytes, Unaligned)]
#[derive(Debug, Clone, Copy, AsBytes, FromZeroes, FromBytes, Unaligned)]
#[repr(C)]
pub struct SpanEnterRecord {
pub header: RecordHeader,
Expand All @@ -71,7 +71,7 @@ impl SpanEnterRecord {
}
}

#[derive(AsBytes, FromZeroes, FromBytes, Unaligned)]
#[derive(Debug, Clone, Copy, AsBytes, FromZeroes, FromBytes, Unaligned)]
#[repr(C)]
pub struct SpanExitRecord {
pub header: RecordHeader,
Expand All @@ -92,7 +92,7 @@ impl SpanExitRecord {
}
}

#[derive(AsBytes, FromZeroes, FromBytes, Unaligned)]
#[derive(Debug, Clone, Copy, AsBytes, FromZeroes, FromBytes, Unaligned)]
#[repr(C)]
pub struct SpanValueRecord {
pub header: RecordHeader,
Expand All @@ -115,7 +115,7 @@ impl SpanValueRecord {
}
}

#[derive(AsBytes, FromZeroes, FromBytes, Unaligned)]
#[derive(Debug, Clone, Copy, AsBytes, FromZeroes, FromBytes, Unaligned)]
#[repr(C)]
pub struct SpanFollowsRecord {
pub header: RecordHeader,
Expand Down