#debug #output #hashmap

debug-map-sorted

Sorted Debug impl for HashMap

2 releases

Uses new Rust 2021

0.1.1 Nov 9, 2022
0.1.0 Nov 8, 2022

#680 in Rust patterns

Download history 41/week @ 2022-11-04 10/week @ 2022-11-11

51 downloads per month

MIT/Apache

4KB

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

~350KB