valet

Crates.iovalet
lib.rsvalet
version0.1.1
sourcesrc
created_at2022-04-17 05:04:38.381082
updated_at2022-04-17 05:05:35.890195
descriptionStores your objects and gives you a tag to retrieve them later.
homepage
repositoryhttps://github.com/agausmann/valet
max_upload_size
id569300
size5,712
Adam Gausmann (agausmann)

documentation

README

Valet

Stores your objects, and gives you a tag to retrieve them later.

This is my own solution to the problem of self-referential data. A common pattern is to eliminate cycles by storing all items in a central collection, and where you would usually store references or smart pointers, you instead store an index/key into the collection. In this case, the Valet type is the collection, and the Tag type is the index.

I found that I was often wanting to use this pattern in different projects, and so instead of writing the same boilerplate to generate indexes I decided to turn it into a library. That also gave me an excuse to add other nice-to-have features, like better type safety for indexes, using a generic newtype Tag<T> instead of a plain type like u64.

Commit count: 6

cargo fmt