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

#369 in Data structures

Download history 2329/week @ 2024-08-19 2307/week @ 2024-08-26 2199/week @ 2024-09-02 1577/week @ 2024-09-09 1797/week @ 2024-09-16 1397/week @ 2024-09-23 2434/week @ 2024-09-30 1563/week @ 2024-10-07 2118/week @ 2024-10-14 2593/week @ 2024-10-21 2834/week @ 2024-10-28 3281/week @ 2024-11-04 2846/week @ 2024-11-11 3053/week @ 2024-11-18 3298/week @ 2024-11-25 4138/week @ 2024-12-02

13,529 downloads per month
Used in 34 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