#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 135/week @ 2024-07-19 140/week @ 2024-07-26 215/week @ 2024-08-02 26/week @ 2024-08-09 230/week @ 2024-08-16 8/week @ 2024-08-23 9/week @ 2024-08-30 14/week @ 2024-09-06 7/week @ 2024-09-13 25/week @ 2024-09-20 147/week @ 2024-09-27 42/week @ 2024-10-04 74/week @ 2024-10-11 89/week @ 2024-10-18 61/week @ 2024-10-25 45/week @ 2024-11-01

271 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–310KB