libdd_profiling/internal/
stack_trace.rs1use super::*;
5
6#[derive(Eq, PartialEq, Hash)]
7pub struct StackTrace {
8 pub locations: Vec<LocationId>,
11}
12
13impl Item for StackTrace {
14 type Id = StackTraceId;
15}
16
17#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
18#[repr(C)]
19#[cfg_attr(test, derive(bolero::generator::TypeGenerator))]
20pub struct StackTraceId(u32);
21
22impl Id for StackTraceId {
23 type RawId = usize;
24
25 fn from_offset(inner: usize) -> Self {
26 #[allow(clippy::expect_used)]
27 let index: u32 = inner.try_into().expect("StackTraceId to fit into a u32");
28 Self(index)
29 }
30
31 fn to_raw_id(&self) -> Self::RawId {
32 self.0 as Self::RawId
33 }
34}
35
36impl From<StackTraceId> for u32 {
37 fn from(value: StackTraceId) -> Self {
38 value.0
39 }
40}