RiteLinked - LinkedHashMap & LinkedHashSet in Rust

Overview

RiteLinked -- HashMap-like containers that hold their key-value pairs in a user controllable order

Latest Version API Documentation

RiteLinked provides more up to date versions of LinkedHashMap & LinkedHashSet . You can easily use it on std or no_std environment.

Support some practical feature combinations to help you better embed them in existing code: serde, inline-more etc. Especially, it uses griddle by default, if you have a lot of data, it can effectively help you reduce the possible tail delay. (Of course, hashbrown can also be used)

Usage

Add ritelinked to Cargo.toml:

ritelinked = "x.y.z"

Write some code like this:

let mut lru_cache = LinkedHashMap::new();
let key = "key".to_owned();
let _cached_val = lru_cache
    .raw_entry_mut()
    .from_key(&key)
    .or_insert_with(|| (key.clone(), 42));

Credit

It is a fork of the popular crate hashlink, but more adjustments and improvements have been made to the code .

License

This library is licensed the same as hashlink, it is licensed under either of:

at your option.

Comments
  • Is it a common practice to make one commit mixing the changes with origin codes, when forked other's repository?

    Is it a common practice to make one commit mixing the changes with origin codes, when forked other's repository?

    ref: https://github.com/datafuselabs/databend/issues/3979

    Hi @wangzhen11aaa , this question is about ritelinked, and I think we can open an issue at https://github.com/dataslime/ritelinked .


    I'm glad you're interested in ritelinked. ritelinked is derived from hashlink and they share most of the code logic. The main differences are these:

    • some new features, such as amortized, support no_std
    • better maintenance and well organization (eg. ritelinked's serde module was fixed earlier than hashlink)
    • some functions such as get_refresh, retain

    see old commit history: https://github.com/dataslime/ritelinked/commits/ritelabs/ritelinked

    Also, it is a fact that ritelinked is pretty much my personal hashlink fork, although it is used by some projects. Since I plan to do some rewrites, I overwrite the commit records under the main branch, sorry for the confusion.

    opened by PsiACE 3
  • Derive Deserialize

    Derive Deserialize

    I would like to use LinkedHashSet/Map in this struct that I derive Deserialize on:

    #[derive(Deserialize, Serialize, Clone)]
    pub struct RunState {
        functions: Vec<RuntimeFunction>,
        blocked: LinkedHashSet<usize>,
    }
    

    How can I do that without having to write a serializer/deserializer?

    opened by andrewdavidmackenzie 0
  • Implement missing APIs

    Implement missing APIs

    The following API should be implemented:

    Current expectations

    • [ ] Entries API, used by ckb-util
    • [ ] rayon support, just like indexmap or griddle
    • [ ] compare with linked_hash_set

    Need to discuss

    • [ ] Some API consistent with the behavior of or_insert and or_insert_with in linked-hash-map

    Anyone can implement these by hand, and add relevant discussions below.

    enhancement good first issue help wanted 
    opened by PsiACE 0
  • Add more docs and comprehensive tests.

    Add more docs and comprehensive tests.

    RiteLinked is similar to most other implementations such as linked-hash-map & linked-hash-set, but adding more documentation and improving test coverage is still necessary.

    documentation good first issue help wanted 
    opened by PsiACE 0
  • Convert to 0-unsafe code or try Raw API?

    Convert to 0-unsafe code or try Raw API?

    I noticed that @quininer has implemented a 0-unsafe LinkedHashMap. See https://github.com/quininer/linkedhashmap . It seems that 0-unsafe has no loss in performance.

    I have no prejudice against unsafe, I just think it is a very interesting work.

    enhancement help wanted 
    opened by PsiACE 2
Releases(v0.3.2)
  • v0.3.2(Aug 24, 2021)

  • v0.3.0(May 4, 2021)

    Glad to welcome hashbrown v0.11 and griddle v0.5.1

    • feat(map): add to_front & to_back methods
    • fix(set): check ordering when comparing sets
    • build(deps): upgrade to hashbrown 0.11 & griddle 0.5
    Source code(tar.gz)
    Source code(zip)
  • v0.2.2(Mar 6, 2021)

    RiteLinked provides more up to date versions of LinkedHashMap & LinkedHashSet in Rust . You can easily use it on std or no_std environment.

    Support some practical feature combinations to help you better embed them in existing code: serde, inline-more etc. Especially, it uses griddle by default, if you have a lot of data, it can effectively help you reduce the possible tail delay. (Of course, hashbrown can also be used)

    Source code(tar.gz)
    Source code(zip)
Ternary search tree collection in rust

tst Ternary search tree collection in rust with similar API to std::collections as it possible. Ternary search tree is a type of trie (sometimes calle

Alexey Pervushin 20 Dec 7, 2022
Array helpers for Rust's Vector and String types

array_tool Array helpers for Rust. Some of the most common methods you would use on Arrays made available on Vectors. Polymorphic implementations for

Daniel P. Clark 69 Dec 9, 2022
Generic array types in Rust

generic-array This crate implements generic array types for Rust. Requires minumum Rust version of 1.36.0, or 1.41.0 for From<[T; N]> implementations

Bartłomiej Kamiński 325 Dec 25, 2022
A priority queue for Rust with efficient change function.

PriorityQueue This crate implements a Priority Queue with a function to change the priority of an object. Priority and items are stored in an IndexMap

null 139 Dec 30, 2022
K-dimensional tree in Rust for fast geospatial indexing and lookup

kdtree K-dimensional tree in Rust for fast geospatial indexing and nearest neighbors lookup Crate Documentation Usage Benchmark License Usage Add kdtr

Rui Hu 152 Jan 2, 2023
Roaring bitmap implementation for Rust

RoaringBitmap This is not yet production ready. The API should be mostly complete now. This is a Rust port of the Roaring bitmap data structure, initi

Roaring bitmaps: A better compressed bitset 552 Jan 1, 2023
Rust Persistent Data Structures

Rust Persistent Data Structures Rust Persistent Data Structures provides fully persistent data structures with structural sharing. Setup To use rpds a

Diogo Sousa 883 Dec 31, 2022
Rust crate to extend io::Read & io::Write types with progress callbacks

progress-streams Rust crate to provide progress callbacks for types which implement io::Read or io::Write. Examples Reader extern crate progress_strea

Pop!_OS 19 Dec 3, 2022
Parameterized routing for generic resources in Rust

Usher Usher provides an easy way to construct parameterized routing trees in Rust. The nodes of these trees is naturally generic, allowing Usher to le

Isaac Whitfield 34 Oct 22, 2022
A proof of concept implementation of cyclic data structures in stable, safe, Rust.

A proof of concept implementation of cyclic data structures in stable, safe, Rust. This demonstrates the combined power of the static-rc crate and the

null 157 Dec 28, 2022
Doubly-Linked List Implementation in Rust

Doubly-Linked List Implementation in Rust Purely for educational and recreational purposes. For real world production please use std::collections::Lin

Tsoding 9 Jul 28, 2022
Rust library for string parsing of basic data structures.

afmt Simple rust library for parsing basic data structures from strings. Usage You can specify string formats to any strucute, via the use of the fmt

Eduard 4 May 8, 2021
Hash Table Implementation in Rust

Hash Table Implementation in Rust Purely for educational and recreational purposes. For real world production please use std::collections::HashMap. Fo

Tsoding 11 Sep 6, 2022
SegVec data structure for rust. Similar to Vec, but allocates memory in chunks of increasing size.

segvec This crate provides the SegVec data structure. It is similar to Vec, but allocates memory in chunks of increasing size, referred to as "segment

Jacob Ryan McCollum 30 Dec 16, 2022
Serde is a framework for serializing and deserializing Rust data structures efficiently and generically.

Serde is a framework for serializing and deserializing Rust data structures efficiently and generically.

null 6.5k Dec 31, 2022
Blazing fast immutable collection datatypes for Rust.

imbl Blazing fast immutable collection datatypes for Rust. This is a fork of the im crate, which appears to be unmaintained. (This fork is not current

null 38 Jul 11, 2022
Algorithms and Data Structures of all kinds written in Rust.

Classic Algorithms in Rust This repo contains the implementation of various classic algorithms for educational purposes in Rust. Right now, it is in i

Alexander González 49 Dec 14, 2022
VLists in rust

Running WORK IN PROGRESS! (0. curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh) 1. cargo test Motivation In the urbit memory model every

Anton Dyudin 4 Jan 29, 2022
Use Rust to solve questions on Leetcode.

Rust for Leetcode 本仓库用于记录我使用Rust刷Leetcode的代码,尽量做到日更。 题目列表 编号 名称 题目类型 题解 678 有效的括号字符串 栈 valid-parenthesis-string.rs 461 汉明距离 位运算 hamming-distance.rs 62

Rui Li 1 Mar 3, 2022