Crates.io | petitset |
lib.rs | petitset |
version | 0.2.1 |
source | src |
created_at | 2022-01-21 20:34:11.129302 |
updated_at | 2022-02-08 18:17:06.093049 |
description | An ordered set data structure, optimized for stack-allocated storage of a tiny number of elements with a fixed cap. |
homepage | https://leafwing-studios.com |
repository | https://github.com/leafwing-studios/petitset |
max_upload_size | |
id | 518734 |
size | 75,245 |
Array-backed ordered set and map data structures in Rust, optimized for stack-allocated storage of a tiny number of elements with a fixed cap.
All you need is Eq
!
This crate is:
no_std
compatiblethiserror
or serde
integration)This crate is designed to be used in performance-sensitive contexts with a small number of elements, where iteration is more common than look-ups and you don't mind a fixed size. One particularly useful quirk is that elements are not recompacted upon removal: this can be very useful when replacing elements in a set or using the indexes that the elements are stored at in a semantic fashion. Iteration order is guaranteed to be stable, on a first-in-first-out basis.
If this isn't what you're after, check out one of these alternatives!
HashSet
when the number of elements is too large. Unordered.Hash
, unbounded size.Ord
, unbounded size.Hash
, unbounded size.This crate has a reasonable collection of convenience methods for working with both sets and maps, aiming for rough equivalence with HashMap
and HashSet
.
If you'd like more, please submit an issue or PR!