#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

#5 in #anymap

Download history 23/week @ 2023-11-25 100/week @ 2023-12-09 44/week @ 2023-12-23 31/week @ 2023-12-30 2/week @ 2024-01-06 29/week @ 2024-01-13 39/week @ 2024-01-20 53/week @ 2024-01-27 2/week @ 2024-02-03 14/week @ 2024-02-17 36/week @ 2024-02-24 6/week @ 2024-03-02 3/week @ 2024-03-09

59 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