Crates.io | indexland |
lib.rs | indexland |
version | |
source | src |
created_at | 2025-02-22 14:23:05.070227+00 |
updated_at | 2025-03-07 03:31:21.349948+00 |
description | Rust Collections with Newtype Indices |
homepage | |
repository | https://github.com/cmrschwarz/indexland |
max_upload_size | |
id | 1565417 |
Cargo.toml error: | TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Wrappers for common collection types based on newtype indices. Increased type safety and code readability without runtime overhead.
use indexland::{Idx, IndexVec};
#[derive(Idx)]
struct NodeId(u32);
struct Node<T> {
prev: NodeId,
next: NodeId,
data: T,
}
struct DoublyLinkedList<T> {
nodes: IndexVec<NodeId, Node<T>>,
}
use indexland::{enum_index_array, EnumIndexArray, Idx};
#[derive(Idx)]
enum PrimaryColor {
Red,
Green,
Blue,
}
const COLOR_MAPPING: EnumIndexArray<PrimaryColor, u32> = enum_index_array![
PrimaryColor::Red => 0xFF0000,
PrimaryColor::Green => 0x00FF00,
PrimaryColor::Blue => 0x0000FF,
];
let my_color = COLOR_MAPPING[PrimaryColor::Red];
IndexSlice<I, T>
wrapping &[T]
IndexArray<I, T, LEN>
wrapping [T; LEN]
IndexVec<I, T>
wrapping Vec<T>
IndexVecDeque<I, T>
wrappingVecDeque<T>
IndexSmallVec<I, T, CAP>
wrapping SmallVec<[T;CAP]>
(Optional)IndexArrayVec<I, T, CAP>
wrapping ArrayVec<T, CAP>
(Optional)IndexHashMap<I, K, V>
wrapping IndexMap<K, V>
(Optional)IndexHashSet<I, T>
wrapping IndexSet<T>
(Optional)NonMax<T>
Integer Types for Niche Optimizations (Optional)serde
support for all Collections (Optional)