static_type_map 0.5.2

A type map that works over all types implementing `Any`
Documentation

🦀 StaticTypeMap

A map where the key is the type of the value.


You may be looking for:

Example

use static_type_map::TypeMap;

let mut type_map = TypeMap::new();
type_map.insert(10u8);
type_map.insert(20u16);
type_map.insert(true);
type_map.insert("a");

assert!(type_map.contains::<bool>());

assert_eq!(type_map.get::<&str>(), Some(&"a"));

if let Some(previous_value) = type_map.insert(50u8) {
assert_eq!(previous_value, 10u8);
}

type_map.remove::<u16>();

assert_eq!(type_map.len(), 3);

Features

name default ? description
send yes Enables [SendTypeMap]
sync yes Enables [SyncTypeMap]
hashbrown no Enables no_std support