Skip to content

Commit 8645cc7

Browse files
committed
fixup! Break ties of PreferDistinct submissions with equal counts
hello serde
1 parent 5257b48 commit 8645cc7

3 files changed

Lines changed: 3 additions & 11 deletions

File tree

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ciborium = { version = "0.2.2", features = ["std"] }
2828
clap = { version = "4.5.60", features = ["derive", "std"] }
2929
criterion = { version = "0.8", features = ["async_tokio"] }
3030
crossbeam-skiplist = { version = "0.1.3", features = ["std"] }
31-
dashmap = { version = "6.1.0" }
31+
dashmap = { version = "6.1.0", features = ["serde"] }
3232
either = { version = "1.13.0" }
3333
futures = { version = "0.3.32" }
3434
http = { version = "1.4.0" }

opsqueue/src/consumer/dispatcher/metastate.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,7 @@ impl MetaStateField {
109109
/// in a single FFI call.
110110
#[must_use]
111111
pub fn to_json(&self) -> String {
112-
use std::fmt::Write as _;
113-
let mut out = String::from("{");
114-
for entry in &self.vals_to_counts {
115-
if out.len() > 1 {
116-
out.push(',');
117-
}
118-
let _ = write!(out, "\"{}\":{}", entry.key(), entry.value());
119-
}
120-
out.push('}');
121-
out
112+
serde_json::to_string(&self.vals_to_counts).unwrap_or_else(|_| String::from("{}"))
122113
}
123114
}
124115

0 commit comments

Comments
 (0)