Crate debug_map_sorted

Source
Expand description

§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 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\"}"
);

Structs§

SortedHashMapDebugOutput
A wrapper for HashMap which sorts itself for Debug output

Traits§

SortedOutputExt
An extension trait for easier production of SortedHashMapDebugOutput values