1 <?xml version="1.0" encoding="utf-8"?>
2 <AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
4 std::collection::Hash* container visualizers
7 std::collections::hash::set::HashSet<K, S> is implemented in terms of...
8 std::collections::hash::map::HashMap<K, V, S> is implemented in terms of...
9 hashbrown::map::HashMap<K, V, S> is implemented in terms of...
10 hashbrown::raw::RawTable<(K, V)>
12 Ideally, we'd teach rustc to scan dependencies/crates for .natvis files so
13 the bulk of this could live alongside the hashbrown crate implementation,
14 and std would just forward using e.g. <ExpandedItem>base</ExpandedItem>.
16 However, Given that std...Hash*Set* is currently implemented in terms of
17 hashbrown...Hash*Map*, which would visualize poorly, we want to customize the
18 look/feel at the std type level *anyways*...
21 https://github.com/rust-lang/rust/blob/master/src/libstd/collections/hash/map.rs
22 https://github.com/rust-lang/rust/blob/master/src/libstd/collections/hash/set.rs
23 https://github.com/rust-lang/hashbrown/blob/master/src/map.rs
24 https://github.com/rust-lang/hashbrown/blob/master/src/set.rs
25 https://github.com/rust-lang/hashbrown/blob/master/src/raw/mod.rs
28 <Type Name="std::collections::hash::map::HashMap<*,*,*>">
29 <DisplayString>{{ size={base.table.items} }}</DisplayString>
31 <Item Name="[size]">base.table.items</Item>
32 <Item Name="[capacity]">base.table.items + base.table.growth_left</Item>
33 <Item Name="[state]">base.hash_builder</Item>
36 <Variable Name="i" InitialValue="0" />
37 <Variable Name="n" InitialValue="base.table.items" />
38 <Size>base.table.items</Size>
40 <Break Condition="n == 0" />
41 <If Condition="(base.table.ctrl.pointer[i] & 0x80) == 0">
42 <!-- Bucket is populated -->
44 <Item Name="{static_cast<tuple<$T1, $T2>*>(base.table.ctrl.pointer)[-(i + 1)].__0}">static_cast<tuple<$T1, $T2>*>(base.table.ctrl.pointer)[-(i + 1)].__1</Item>
52 <Type Name="std::collections::hash::set::HashSet<*,*>">
53 <DisplayString>{{ size={map.base.table.items} }}</DisplayString>
55 <Item Name="[size]">map.base.table.items</Item>
56 <Item Name="[capacity]">map.base.table.items + map.base.table.growth_left</Item>
57 <Item Name="[state]">map.base.hash_builder</Item>
60 <Variable Name="i" InitialValue="0" />
61 <Variable Name="n" InitialValue="map.base.table.items" />
62 <Size>map.base.table.items</Size>
64 <Break Condition="n == 0" />
65 <If Condition="(map.base.table.ctrl.pointer[i] & 0x80) == 0">
66 <!-- Bucket is populated -->
68 <Item>static_cast<$T1*>(map.base.table.ctrl.pointer)[-(i + 1)]</Item>