ident-0.3.10 doesn't have any documentation.
ident
A Rust utility crate for wrapping types with an immutable identifier and storing/accessing such types in collections by that identifier.
How Do I Use This Crate?
First add the crate to your Cargo.toml:
[]
= "*" # or the specific version you want to use.
And import the crate to your own main.rs/lib.rs:
extern crate ident;
use *;
Ok, But What Does This Crate Do?
Lets say you have some type:
And you have a collection of Foos
use HashMap;
Its often useful to remember where you got you value from (my_foos[5] in this case). That would normally mean creating a new variable which you have to remember to pass everywhere but with ident:
use *;
use HashMap;
We are able to get the key bundled with the value while still accessing the value as if the key wasn't there.
This is a simple use case however:
- Getting and Inserting with an "identifier" is implemented on standard collections.
- Rust is able to infer the type of your value without your intervention.
- There are several utility functions for
WithIdentwhich allow you to manipulate the inner value or the identifier as needed.