#linked-list #constant-time #removal #list

no-std linked_list_r4l

Linked lists that supports arbitrary removal in constant time

4 releases (2 breaking)

0.5.0 Apr 2, 2026
0.3.0 Dec 4, 2025
0.2.1 Oct 29, 2024
0.2.0 Oct 22, 2024
0.1.0 Oct 22, 2024

#497 in Rust patterns

Download history 207/week @ 2025-12-29 337/week @ 2026-01-05 256/week @ 2026-01-12 127/week @ 2026-01-19 790/week @ 2026-01-26 636/week @ 2026-02-02 882/week @ 2026-02-09 84/week @ 2026-02-16 1181/week @ 2026-02-23 1376/week @ 2026-03-02 862/week @ 2026-03-09 838/week @ 2026-03-16 905/week @ 2026-03-23 1433/week @ 2026-03-30 748/week @ 2026-04-06 614/week @ 2026-04-13

3,762 downloads per month
Used in 34 crates (via axsched)

GPL-2.0-or-later

43KB
796 lines

LinkedList

Crates.io Doc.rs CI

Linked lists that supports arbitrary removal in constant time.

It is based on the linked list implementation in Rust-for-Linux.

Examples

use linked_list_r4l::{GetLinks, Links, List};

type InnerType = usize;

pub struct ExampleNode {
    pub inner: InnerType,
    links: Links<Self>,
}

impl GetLinks for ExampleNode {
    type EntryType = Self;

    fn get_links(t: &Self) -> &Links<Self> {
        &t.links
    }
}

impl ExampleNode {
    fn new(inner: InnerType) -> Self {
        Self {
            inner,
            links: Links::new()
        }
    }

    fn inner(&self) -> &InnerType {
        &self.inner
    }
}

let node1 = Box::new(ExampleNode::new(0));
let node2 = Box::new(ExampleNode::new(1));
let mut list =  List::<Box<ExampleNode>>::new();

list.push_back(node1);
list.push_back(node2);

// Support Iter
for (i,e) in list.iter().enumerate() {
    assert!(*e.inner() == i);
}

// Pop drop
assert!(*list.pop_front().unwrap().inner() == 0);
assert!(*list.pop_front().unwrap().inner() == 1);

No runtime deps