Skip to content

Unique type identifier for any non-static type (unlike `core::any::Any`)

License

Notifications You must be signed in to change notification settings

storycraft/type-key

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypeKey

Unique type identifier for any non-static type (unlike core::any::Any)

Usage

use type_key::TypeKey;

let a = 1;
let closure = || &a;

let key = TypeKey::of_val(&closure);

Implementation detail

The TypeKey wraps TypeId of closure in TypeKey::of. Since the closure captures its environment, the returned TypeId is unique for each type.

For more explanation about closure lifetime, see: rust-lang/rust#27086

License

MIT

About

Unique type identifier for any non-static type (unlike `core::any::Any`)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages