@@ -8,6 +8,8 @@ use super::util::new_hashmap;
88use ahash:: RandomState as ARandomState ;
99use im:: Vector as ImVector ;
1010use itertools:: Itertools ;
11+ use serde:: Deserialize ;
12+ use serde:: Serialize ;
1113use std:: borrow:: Cow ;
1214use std:: collections:: BTreeMap ;
1315use std:: collections:: HashMap ;
@@ -17,7 +19,7 @@ extern "C" {
1719 fn _exit ( exit_code : std:: os:: raw:: c_int ) ;
1820}
1921
20- #[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash ) ]
22+ #[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
2123pub struct FunctionId ( u64 ) ;
2224
2325impl FunctionId {
@@ -83,7 +85,7 @@ impl FunctionLocations for VecFunctionLocations {
8385pub type LineNumber = u16 ; // TODO u32, newtype
8486
8587/// A specific location: file + function + line number.
86- #[ derive( Clone , Debug , PartialEq , Eq , Copy , Hash ) ]
88+ #[ derive( Clone , Debug , PartialEq , Eq , Copy , Hash , Serialize , Deserialize ) ]
8789pub struct CallSiteId {
8890 /// The function + filename. We use IDs for performance reasons (faster hashing).
8991 function : FunctionId ,
@@ -101,7 +103,7 @@ impl CallSiteId {
101103}
102104
103105/// The current Python callstack.
104- #[ derive( Derivative ) ]
106+ #[ derive( Derivative , Serialize , Deserialize ) ]
105107#[ derivative( Clone , PartialEq , Eq , Hash , Debug ) ]
106108pub struct Callstack {
107109 calls : Vec < CallSiteId > ,
@@ -290,11 +292,10 @@ impl CallstackInterner {
290292const MIB : usize = 1024 * 1024 ;
291293const HIGH_32BIT : u32 = 1 << 31 ;
292294
293- /// A unique identifier for a process. The idea is that each subprocess will be
294- /// given a unique identifier from a counter, and that >4 billion processes is
295- /// unlikely. But the internal representation can change!
296- #[ derive( Clone , Copy , Debug , PartialEq , Ord , PartialOrd , Eq ) ]
297- pub struct ProcessUid ( u32 ) ;
295+ /// A unique identifier for a process.
296+ #[ derive( Clone , Copy , Debug , PartialEq , Ord , PartialOrd , Eq , Serialize , Deserialize ) ]
297+ #[ serde( transparent) ]
298+ pub struct ProcessUid ( pub u32 ) ;
298299
299300pub const PARENT_PROCESS : ProcessUid = ProcessUid ( 0 ) ;
300301
0 commit comments