Commit fadf4e9
authored
* move map.rs into its own folder
* add no-hash-maps crate feature to wasmparser
Disabled by default.
* rename Hash{Map,Set} type aliases to just Map,Set
* switch to BTree{Map,Set} if no-hash-maps is enabled
This introduced a lot of compile errors in case no-hash-maps is actually enabled since many keys are not Ord.
* use BTree{Map,Set} type aliases with no-hash-maps
Some methods are not shared between Hash{Map,Set} and BTree{Map,Set} such as reserve and the Key type has different trait bounds (Eq + Hash) vs (Eq + Ord) which can be confusing when using map and set in wasmparser during development.
Thus we actually do not want to use type aliases but proper types that wraps both Hash{Map,Set} and BTree{Map,Set} and provide a unified API.
The same is true for Index{Map,Set} but we will do this in another commit.
* fix intradoc links
* cfg instead of comment out
This is just a workaround until the new Map/Set type with unified API is done.
* move random state definition into their own file
I want to keep the base mod.rs as clean as possible.
* rename map module to collections
* rename random_state.rs -> hash.rs and make mod pub
* restructure collections module
* fix docs
* add Entry type def to map data structures
* update Set docs
* turn the Set type alias into an opaque type
Currently it only supports mostly the minimal API needed to make the wasmparser crate work.
* add Clone derive for Set
* turn the map type into an opaque type
Currently it only mostly supports the minimal API needed to make the wasmparser crate work again.
* fix workspace uses of wasparser collection types
* apply rustfmt
* add Iterator API for Set
* add Iterator API to Map
* simplify type defs and cfg guards
* remove unnecessary cfg guard
* simplify type aliases
* add IterMut for Map
* improve doc links
* add FromIterator impls for Map and Set
They are used in IndexMap so for symmetry I add them here too.
* add Map::reserve
symmetry: this method is used by both Set and IndexMap
* add IntoIterator API for Map and Set
symmetry: used on IndexMap
* add Keys, Values and ValuesMut iterators for Map
* improve docs of iter_mut
* add doc link
* add Map::contains_key
* add doc link
* add Index trait impl for Map
* add Extent trait impl for Map and Set
* update collections module docs
* add doc comment
* move Ord trait bound into impl
* apply rustfmt
* implement Ord and PartialOrd for KebabString
* fix errors with upcoming IndexMap type usage
* add IndexMap wrapper type
This is still missing the custom IndexMap implementation when `no-hash-maps` is enabled.
* add missing Index<usize> impl to IndexMap
* add IndexMap::swap_remove
used by IndexSet within wasmparser. We add this to keep APIs as mirrored as possible.
* add doc link in doc comment for Set
* add Set::replace
Used by IndexSet in wasmparser. Keep this for API mirroring.
* add basic set methods: Set::{is_disjoint, is_subset, is_superset}
* PartialOrd and Ord impls for some types that were still missing them
This is for IndexSet opaque type usage to work.
* add opaque IndexSet type
This does not yet support the custom implementation that avoid usage of hash maps internally.
* improve collections module docs
* improve docs of [Index]{Hash,Set} types
* apply rustfmt
* remove OccupiedEntry::[swap_]remove
We removed this API because it was unused in wasmparser and implementing it on the custom BTreeMap based IndexMap is very cumbersome to do.
* add BTreeMap based IndexMap backend
This required us to add some Clone trait bounds to parts of the IndexMap API.
* properly mirrior internal insert_full signature
* add opaque IndexSet type
* add where bounds to FusedIterator impls
* remove unused import
* add forwarding size_hint impls
* fix bug in detail::IndexMap::is_empty
* add GitHub CI job for no-hash-maps crate feature testing
* simplify API surface of detail::IndexSet
* base IndexSet impl on IndexMap<T, ()>
* complete wasmparser::collections::Map shared API surface
* complete wasmparser::collections::Set shared API surface
* fix no-hash-maps compile error
* fix bug in IndexMap::swap_remove_full impl
For the no-hash-maps custom impl.
* properly fix swap_remove_full and apply fmt
* fix doc links
* always compile custom IndexMap implementation
This is friendlier for maintenance and developers.
* add tests for custom IndexMap implementation
1 parent 443fc54 commit fadf4e9
18 files changed
Lines changed: 3543 additions & 70 deletions
File tree
- .github/workflows
- crates
- wasm-compose/src
- wasmparser
- src
- collections
- index_map
- readers/core
- validator
- wit-parser/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
59 | 71 | | |
60 | 72 | | |
61 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
730 | 730 | | |
731 | 731 | | |
732 | 732 | | |
733 | | - | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
734 | 737 | | |
735 | 738 | | |
736 | 739 | | |
| |||
739 | 742 | | |
740 | 743 | | |
741 | 744 | | |
742 | | - | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
743 | 749 | | |
744 | 750 | | |
745 | 751 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
48 | 54 | | |
49 | 55 | | |
50 | 56 | | |
| |||
Lines changed: 1 addition & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
| 1 | + | |
7 | 2 | | |
8 | 3 | | |
9 | 4 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | 5 | | |
23 | 6 | | |
24 | 7 | | |
| |||
0 commit comments