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

#412 in Data structures

Download history 2462/week @ 2024-08-28 1978/week @ 2024-09-04 1815/week @ 2024-09-11 1415/week @ 2024-09-18 1933/week @ 2024-09-25 2210/week @ 2024-10-02 1384/week @ 2024-10-09 2407/week @ 2024-10-16 2611/week @ 2024-10-23 3523/week @ 2024-10-30 2525/week @ 2024-11-06 3385/week @ 2024-11-13 2665/week @ 2024-11-20 4156/week @ 2024-11-27 3723/week @ 2024-12-04 3381/week @ 2024-12-11

14,567 downloads per month
Used in 35 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