Crates.io | type-key |
lib.rs | type-key |
version | 1.0.0 |
source | src |
created_at | 2023-06-22 07:32:53.359259 |
updated_at | 2023-06-22 14:26:28.224945 |
description | Unique type identifier for any non-static type |
homepage | |
repository | |
max_upload_size | |
id | 896983 |
size | 3,472 |
Unique type identifier for any non-static type (unlike core::any::Any
)
use type_key::TypeKey;
let a = 1;
let closure = || &a;
let key = TypeKey::of_val(&closure);
The TypeKey
wraps TypeId
of closure in TypeKey::of
. Since the closure captures its environment, the returned TypeId
is unique for each type.
MIT