Crates.io | tucan |
lib.rs | tucan |
version | 0.1.5 |
source | src |
created_at | 2023-04-13 18:27:34.332729 |
updated_at | 2023-04-14 01:04:35.375059 |
description | A simple, fast, and multithreaded interner with loose type requirement. |
homepage | |
repository | https://github.com/Dherse/tucan/tree/main |
max_upload_size | |
id | 838596 |
size | 19,911 |
Tucan is a very basic interner with garbage collection. It adds an Intern
trait that allows you to intern any type that implements Hash
, Send
, Sync
and Eq
. Keys to interned elements are called Interned
and are wrapper around a Arc<T>
. They implement Deref
for T
and Clone
. When calling the gc()
function, tucan looks for all entries in the interner that are not referenced by any Interned
and removes them.
Tucan uses sip-hash for checking whether two values are the same. Therefore values with colliding hashes will be interned as the same values if they are of the same type. This means that conflicts are possible. This is a concious design decision to keep the interner simple and fast with very loose requirements on the types that can be interned.