#typemap #map #anymap

unmaintained no-std static_type_map

A type map that works over all types implementing Any

10 unstable releases (4 breaking)

0.5.2 May 11, 2022
0.5.1 May 8, 2022
0.4.1 Feb 6, 2022
0.4.0 Jan 14, 2022
0.1.1 Jun 25, 2020

#6 in #anymap

Download history 49/week @ 2024-03-13 52/week @ 2024-03-20 204/week @ 2024-03-27 297/week @ 2024-04-03 76/week @ 2024-04-10 8/week @ 2024-04-17 19/week @ 2024-04-24 2/week @ 2024-05-01 1/week @ 2024-05-15 4/week @ 2024-05-22 7/week @ 2024-05-29 10/week @ 2024-06-05 6/week @ 2024-06-12 25/week @ 2024-06-19 9/week @ 2024-06-26

52 downloads per month

MIT license

15KB
124 lines

🦀 StaticTypeMap

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


⚠️ This crate has been renamed to erased_set.

License

Licensed under MIT license.


lib.rs:

🦀 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

Dependencies

~0–315KB