Crates.io | velect |
lib.rs | velect |
version | 0.2.0 |
source | src |
created_at | 2023-12-26 06:58:38.34867 |
updated_at | 2024-01-10 16:56:49.07299 |
description | A Vec with item / index selection |
homepage | |
repository | https://github.com/CerulanLumina/velect |
max_upload_size | |
id | 1080668 |
size | 55,377 |
velect
is a Rust crate that provides a vector-like type
with item selection functionality - which here means either
zero or one index from the vector is "selected" and can
be retrieved easily without needing to manually track
the index of the selected item
Velect does the index tracking for you - it maintains the selected index, updating it whenever a mutation necessitates it.
Velect implements Deref<Target = Vec<_>>
, which allows
you to use all non-mutating functions from Vec
as well
as [T]
transparently. Mutating functions (those taking
&mut self
as a parameter) are reimplemented with
compatible interfaces, helping make Velect
a close-to-drop-in
replacement for Vec
.
Additionally, Velect<T>
also implements many of the same
traits as Vec<T>
.
Velect is licensed under MPL 2.0 which allows you to use it in your project as a library for almost any use case with proper attribution. Modifications of Velect should be licensed under a similar license.
I welcome PRs and issue creation. When contributing code you agree to assign copyright of the code you contribute to the project in the understanding it will remain licensed under MPL 2.0 or another similarly weak or stronger copyleft license.