MCPcopy Index your code
hub / github.com/alexheretic/linked-hash-set

github.com/alexheretic/linked-hash-set @0.1.6

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.1.6 ↗ · + Follow
86 symbols 158 edges 2 files 36 documented · 42%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

linked_hash_set crates.io Documentation =================

This library provides an hashed set with predictable iteration order, based on the insertion order of elements. It is implemented as a linked_hash_map::LinkedHashMap where the value is (), in a similar way as HashSet is implemented from HashMap in stdlib.

Comparison with std HashSet

General usage is very similar to a traditional hashed set, but this structure also maintains insertion order.

Compared to HashSet, a LinkedHashSet uses an additional doubly-linked list running through its entries. As such methods front(), pop_front(), back(), pop_back() and refresh() are provided.

Comparison with IndexSet

Compared to indexmap::IndexSet, while both maintain insertion order a LinkedHashSet uses a linked list allowing performant removals that don't affect the order of the remaining elements. However, when this distinction is unimportant indexmap should be the faster option.

Example

let mut set = linked_hash_set::LinkedHashSet::new();
assert!(set.insert(234));
assert!(set.insert(123));
assert!(set.insert(345));
assert!(!set.insert(123)); // Also see `insert_if_absent` which won't change order

assert_eq!(set.into_iter().collect::<Vec<_>>(), vec![234, 345, 123]);

Minimum supported rust compiler

This crate is maintained with latest stable rust.

Core symbols most depended-on inside this repo

Shape

Method 50
Function 27
Class 9

Languages

Rust100%

Modules by API surface

src/lib.rs77 symbols
src/serde.rs9 symbols

For agents

$ claude mcp add linked-hash-set \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page