slotmap icon indicating copy to clipboard operation
slotmap copied to clipboard

Custom Debug impl for Map types

Open aDotInTheVoid opened this issue 3 years ago • 0 comments

Before:

[examples/debug.rs:10] &x = SlotMap {
    slots: [
        Slot {
            version: 0,
            next_free: 0,
        },
        Slot {
            version: 1,
            value: "a",
        },
        Slot {
            version: 1,
            value: "b",
        },
        Slot {
            version: 1,
            value: "c",
        },
    ],
    free_head: 4,
    num_elems: 3,
    _k: PhantomData,
}
[examples/debug.rs:16] x = SlotMap {
    slots: [
        Slot {
            version: 0,
            next_free: 0,
        },
        Slot {
            version: 3,
            value: "later",
        },
        Slot {
            version: 1,
            value: "b",
        },
        Slot {
            version: 1,
            value: "c",
        },
    ],
    free_head: 4,
    num_elems: 3,
    _k: PhantomData,
}

After:

[examples/debug.rs:10] &x = {
    CustomKey(
        1v1,
    ): "a",
    CustomKey(
        2v1,
    ): "b",
    CustomKey(
        3v1,
    ): "c",
}
[examples/debug.rs:16] x = {
    CustomKey(
        1v3,
    ): "later",
    CustomKey(
        2v1,
    ): "b",
    CustomKey(
        3v1,
    ): "c",
}

Fixes #65

aDotInTheVoid avatar Jun 23 '21 16:06 aDotInTheVoid