Skip to content

Commit a0b6056

Browse files
committed
Make ProcessUid serializable.
1 parent 3f4565e commit a0b6056

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

Cargo.lock

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

memapi/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ backtrace = "0.3"
1717
once_cell = "1.13"
1818
libloading = "0.7"
1919
libc = "0.2"
20+
serde = {version = "1", features = ["derive"] }
2021

2122
[dependencies.inferno]
2223
version = "0.11"

memapi/src/memorytracking.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ use super::util::new_hashmap;
88
use ahash::RandomState as ARandomState;
99
use im::Vector as ImVector;
1010
use itertools::Itertools;
11+
use serde::Deserialize;
12+
use serde::Serialize;
1113
use std::borrow::Cow;
1214
use std::collections::BTreeMap;
1315
use std::collections::HashMap;
@@ -290,11 +292,10 @@ impl CallstackInterner {
290292
const MIB: usize = 1024 * 1024;
291293
const 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

299300
pub const PARENT_PROCESS: ProcessUid = ProcessUid(0);
300301

0 commit comments

Comments
 (0)