valet 0.1.1

Stores your objects and gives you a tag to retrieve them later.
Documentation
  • Coverage
  • 0%
    0 out of 9 items documented0 out of 8 items with examples
  • Size
  • Source code size: 5.39 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.66 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • agausmann/valet
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • agausmann

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.