#hash-map #debugging #output

debug-map-sorted

Sorted Debug impl for HashMap

2 releases

0.1.1 Nov 9, 2022
0.1.0 Nov 8, 2022

#2627 in Rust patterns

MIT/Apache

5KB

debug-map-sorted

crates.io

An implementation of Debug on a wrapper for HashMap which displays the output in sorted order.

See SortedHashMapDebugOutput for more info.

Example usage

# use std::collections::HashMap;
use debug_map_sorted::SortedOutputExt;

let data: HashMap<usize, &'static str> = [(0, "zero"), (1, "one"), (2, "two")]
                                                .into_iter().collect();
assert_eq!(
    format!("{:?}", data.sorted_debug()),
    "{0: \"zero\", 1: \"one\", 2: \"two\"}"
);

Dependencies

~400KB