4 releases (2 breaking)

0.8.0 Feb 20, 2024
0.7.0 May 30, 2022
0.6.1 May 28, 2022
0.6.0 May 11, 2022

#538 in Data structures

Download history 945/week @ 2024-02-02 882/week @ 2024-02-09 921/week @ 2024-02-16 707/week @ 2024-02-23 1253/week @ 2024-03-01 1100/week @ 2024-03-08 1032/week @ 2024-03-15 1268/week @ 2024-03-22 1813/week @ 2024-03-29 1690/week @ 2024-04-05 2014/week @ 2024-04-12 1319/week @ 2024-04-19 1984/week @ 2024-04-26 1335/week @ 2024-05-03 1410/week @ 2024-05-10 2073/week @ 2024-05-17

7,129 downloads per month
Used in 18 crates (3 directly)

MIT license

21KB
205 lines

🦀 ErasedSet

A set of erased types.


You may be looking for:

License

Licensed under MIT license.


lib.rs:

🦀 ErasedSet

You may be looking for:


This crate provides a new collection: the ErasedSet. It allows storing different types in a single set (as long as they implement Any).

Example

#
use erased_set::ErasedSet;

let mut set = ErasedSet::new();
set.insert(ClickEvent(128, 256));
set.insert(KeyDownEvent('z'));

assert_eq!(set.get::<ClickEvent>(), Some(&ClickEvent(128, 256)));

assert_eq!(set.insert(KeyDownEvent('e')), Some(KeyDownEvent('z')));

set.remove::<ClickEvent>();

assert_eq!(set.len(), 1);

Features

name default ? description
send yes Enables ErasedSendSet
sync yes Enables ErasedSyncSet

no_std support

This crate is no_std compatible, however it still requires alloc.

No runtime deps