typemap 0.0.5

A typesafe store for many value types.
docs.rs failed to build typemap-0.0.5
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: typemap-0.3.3

TypeMap

A typesafe store keyed by types and containing different types of values.

It provides functionality similar to AnyMap, but is more flexible because it allows for key-value pairs, rather than enforcing that keys and values are the same type.

Key-value associations are defined through the Assoc trait, which uses a phantom type parameter and trait coherence rules to enforce the invariants of TypeMap.

Example

#[deriving(Show, PartialEq)]
struct Key;

#[deriving(Show, PartialEq)]
struct Value;

impl Assoc<Value> for Key {}

#[test] fn test_pairing() {
    let mut map = TypeMap::new();
    map.insert::<Key, Value>(Value);
    assert_eq!(*map.find::<Key, Value>().unwrap(), Value);
}