Commit graph

1236 commits

Author SHA1 Message Date
Gwilym Kuiper c677347621
Merge pull request #192 from gwilymk/custom-hashmap
Custom hashmap
2022-03-20 16:08:55 +00:00
Gwilym Kuiper 4a1d99f143 Implement Index and FromIterator and add some tests lifted from rust stdlib 2022-03-20 15:38:39 +00:00
Gwilym Kuiper 2b75ce6cbd Implement all of VacantEntry 2022-03-20 15:14:44 +00:00
Gwilym Kuiper 6bc3816b29 Fully implement OccupiedEntry 2022-03-20 15:13:22 +00:00
Gwilym Kuiper 631e1e9bc2 Start implementing the individual entry types 2022-03-20 15:07:25 +00:00
Gwilym Kuiper 921a338c59 Implement the entirity of the entry api 2022-03-20 14:54:53 +00:00
Gwilym Kuiper 2706b2494d Some wiggling 2022-03-20 14:22:43 +00:00
Gwilym Kuiper 86635752af Also implement or_insert_with_key 2022-03-20 14:21:45 +00:00
Gwilym Kuiper ab80f200e8 Encaspulate a bit better 2022-03-20 14:15:24 +00:00
Gwilym Kuiper 9bfb8de481 Wrap distance_to_initial_bucket a bit better 2022-03-20 14:14:22 +00:00
Gwilym Kuiper 3f624ee87d Fail test in extreme case test if we drop twice 2022-03-20 14:10:38 +00:00
Gwilym Kuiper 9df79a16bd Replace slightly dodgy replace code 2022-03-20 14:04:27 +00:00
Gwilym Kuiper bde36c7019 Invert the order of the HashMap, Node and NodeStorage 2022-03-20 13:59:01 +00:00
Gwilym Kuiper e0d829a4fc Rename get_value_ref and get_value_mut to remove get 2022-03-20 13:57:41 +00:00
Gwilym Kuiper 86760f76ac Move resize to a more sensible place 2022-03-20 13:50:04 +00:00
Gwilym Kuiper e9c56327b1 Avoid duplicating constant 2022-03-20 13:43:31 +00:00
Gwilym Kuiper 3ae0e30d3c Correctly drop key on override 2022-03-20 13:42:28 +00:00
Gwilym Kuiper 9c7d9520a7 Add test that we drop the key on override 2022-03-20 13:41:31 +00:00
Gwilym Kuiper d4ed1cd2fa Allow swapping out the hasher 2022-03-19 23:13:02 +00:00
Gwilym Kuiper e68a4d373f Replace .map().flatten() with .and_then() 2022-03-19 23:10:12 +00:00
Gwilym Kuiper 280e7f876d Add some drop tests 2022-03-19 23:09:21 +00:00
Gwilym Kuiper ee983ef7ec Use MaybeUninit to reduce memory usage by half 2022-03-19 23:09:21 +00:00
Gwilym Kuiper cd9798d01f Move the implementation of get_location to NodeStorage 2022-03-19 23:09:21 +00:00
Gwilym Kuiper 321702531b Move number_of_items to NodeStorage 2022-03-19 23:09:21 +00:00
Gwilym Kuiper 0e89f9190f Rename NodeStorage.len() to NodeStorage.capacity() 2022-03-19 23:09:21 +00:00
Gwilym Kuiper fdc2172b3d Move max_distance_to_initial_bucket to NodeStorage 2022-03-19 23:09:21 +00:00
Gwilym Kuiper cc53b0a911 Change distance_to_initial_bucket to be an i32 2022-03-19 23:09:21 +00:00
Gwilym Kuiper 9f6797f4ed Update lockfiles 2022-03-19 23:09:21 +00:00
Gwilym Kuiper ff709d9d57 Use .drain(..).flatten() 2022-03-19 23:09:21 +00:00
Gwilym Kuiper e9d3c6e5c4 Fix clippy lint that we should define is_empty 2022-03-19 23:09:21 +00:00
Gwilym Kuiper eb00563b09 Add extreme test case and fix bug causing disappearing entries 2022-03-19 23:09:21 +00:00
Gwilym Kuiper 89cc00f8cf Sized is implied 2022-03-19 23:09:21 +00:00
Gwilym Kuiper a6c7eaec1a Correctly calculate new distance to initial bucket 2022-03-19 23:09:21 +00:00
Gwilym Kuiper 12dab0c3ba Fix issue where we weren't considering 0 distance correctly 2022-03-19 23:09:21 +00:00
Gwilym Kuiper f7eb1866c2 Remove hashbrown from object.rs 2022-03-19 23:09:20 +00:00
Gwilym Kuiper 5edd46e085 Add default implementation 2022-03-19 23:08:45 +00:00
Gwilym Kuiper 6ff4cbe4f1 Rename put to insert 2022-03-19 23:08:45 +00:00
Gwilym Kuiper a9115c23e8 Allow for resizing 2022-03-19 23:08:45 +00:00
Gwilym Kuiper 8d976b49bc Extract a node_storage 2022-03-19 23:08:45 +00:00
Gwilym Kuiper e999b44c67 Put nodes in a NodeStorage 2022-03-19 23:08:45 +00:00
Gwilym Kuiper 03f5cd0953 Add with_capacity method 2022-03-19 23:08:45 +00:00
Gwilym Kuiper c0d9f0ab41 Correctly initialise to 16 elements 2022-03-19 23:08:45 +00:00
Gwilym Kuiper bfdca7117d Make fast_mod constant 2022-03-19 23:08:45 +00:00
Gwilym Kuiper dd5aad0de5 Make HashMap struct public 2022-03-19 23:08:45 +00:00
Gwilym Kuiper 05b8accaec Make the hash_map mod public 2022-03-19 23:08:45 +00:00
Gwilym Kuiper a459a4811c Add test for iterating through all entries 2022-03-19 23:08:45 +00:00
Gwilym Kuiper bfebba1ec1 Implement remove 2022-03-19 23:08:45 +00:00
Gwilym Kuiper 019872b8cc Really basic hash map which you can only add stuff to 2022-03-19 23:08:45 +00:00
Corwin 82922abddb
Merge pull request #188 from corwinkuiper/crate-version-numbers
be less specific in version numbers
2022-03-19 15:19:28 +00:00
Corwin ba7d5cf4c4
Merge pull request #194 from gwilymk/fix-clippy-error
Fix clippy errors
2022-03-19 15:19:11 +00:00