GitXplorerGitXplorer
s

indexlist

public
84 stars
8 forks
6 issues

Commits

List of commits on branch master.
Verified
04861bbca85e789756db5531ffa9f96f446eba72

Merge pull request #20 from jackh726/insert_before_after

ssteveklabnik committed a year ago
Unverified
ce682524e274f92c0dbce13651030d55ab2fd068

Remove extern crate

jjackh726 committed a year ago
Unverified
3bcb1df6d7bb1c0ebc5b3895b180381f22699d68

Add insert_before and insert_after

jjackh726 committed a year ago
Verified
a2e7f310256fc97208869e722a4e5dfe582cf748

Merge pull request #16 from ehsanmok/mut_methods

ssteveklabnik committed 6 years ago
Unverified
0af68f6222e7ecb24089a496cecd107b1b6866ad

impl head_mut, get_mut, index_mut and improve docs

eehsanmok committed 6 years ago
Verified
59ea5f853e3d00d65aa0d86d70fa46c611cec7c9

Merge pull request #17 from JoshMcguigan/prev-next

ssteveklabnik committed 6 years ago

README

The README file for this repository.

indexlist - A doubly linked list, backed by a vector.

Build Status Build status

This crate provides a struct, IndexList<T>, which is a doubly-linked list. However, unlike a traditional linked list, which heap allocates each of its nodes individually, all nodes are stored in a vector. Rather than provide pointers to nodes, an Index struct can be used to access a particular element in the middle of the list.

Safety

This crate uses #![deny(unsafe_code)] to ensure everything is implemented in 100% Safe Rust.

Generational indexes

Index uses a generations scheme, so that if you hold an Index to a node, and it's removed, and a new node is allocated in its place, you do not access the new node.

Performance

In general, performance is quite good. Benchmarks against the standard library's LinkedList<T> are provided. But some other details:

  • The list keeps track of its head and tail for efficient insertion.
  • The underlying vector only grows, never shrinks. When a node is removed, its entry is marked as free for future insertions.
  • Free entries are themselves kept as a singly-linked list, meaning that they can be re-used efficiently.

Missing features

Right now, I've only implemented a minimal number of features; there's iter but no into_iter and iter_mut. This is on the to-do list. PRs welcome!