| Crates.io | lookupvec |
| lib.rs | lookupvec |
| version | 0.1.3 |
| created_at | 2025-02-25 06:51:41.81491+00 |
| updated_at | 2025-07-16 22:41:43.43449+00 |
| description | Container with Vec-like properties that also offers O(1) lookup of items based on an id field |
| homepage | |
| repository | https://github.com/agirardeau/agpublic |
| max_upload_size | |
| id | 1568778 |
| size | 40,852 |
Container with Vec-like properties that also offers O(1) lookup of items based on a primary key field
#[derive(PartialEq, Lookup)]
struct MyStruct {
#[lookup_key]
pub name: String,
pub description: String,
pub count: usize,
}
let vec = LookupVec.from([
MyStruct {
name: "foo",
description: "description of foo",
count: 7,
},
MyStruct {
name: "bar",
description: "description of bar",
count: 13,
},
])
assert_eq!(vec[0], vec.get("foo"))
assert_eq!(vec[1], vec.get("bar"))