#linked-list #list #pointers #data-structures

rose_bloom

A concurrent growing element size linked list with stable pointers

2 releases

0.1.5 Apr 15, 2024
0.1.4 Aug 26, 2022

#183 in Concurrency

Download history 3/week @ 2024-02-23 54/week @ 2024-03-01 10/week @ 2024-03-08 1/week @ 2024-03-15 4/week @ 2024-03-29 137/week @ 2024-04-12 11/week @ 2024-04-19

149 downloads per month

MIT OR Unlicense

47KB
747 lines

rose_bloom

rose_bloom is a crate for passing out references that won't move when you push to it. It is also thread-safe, so you can use it as a concurrent queue if you don't care about freeing memory as you go along. It is lock-free.

Many operations are O(lg n). This will still be extremely fast.

Example

use rose_bloom::Rose;

let rose = Rose::new();
let out1 = rose.push(1);
rose.push(2);
rose.push(3);
println!("{out1}"); // 1

Installation

Add this to your Cargo.toml:

[dependencies]
rose_bloom = "0.1"

#![no_std]

This crate is #![no_std] but does require alloc.

Licenses


lib.rs:

This library provides the Rose type, a data structure with stable pointers.

It is also concurrent and lock-free. The concurrency was a secondary goal of this project, but you can't have a safe API that is useful without Atomics, and it is more useful regardless.

Example

use rose_bloom::Rose;

let rose = Rose::new();
let out1 = rose.push(1);
rose.push(2);
rose.push(3);

println!("{out1}"); // 1

Compare this to the same code with a [Vec], which does not compile and should not compile:

let mut vect = Vec::new();
vect.push(1);
let out1 = &vect[0];
vect.push(2);
vect.push(3);

println!("{out1}");

No runtime deps