Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/storycraft/type-key
Unique type identifier for any non-static type (unlike `core::any::Any`)
https://github.com/storycraft/type-key
any rust typeid
Last synced: 15 days ago
JSON representation
Unique type identifier for any non-static type (unlike `core::any::Any`)
- Host: GitHub
- URL: https://github.com/storycraft/type-key
- Owner: storycraft
- License: mit
- Created: 2023-06-22T07:31:45.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-22T03:12:09.000Z (over 1 year ago)
- Last Synced: 2024-10-19T14:42:38.001Z (2 months ago)
- Topics: any, rust, typeid
- Language: Rust
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TypeKey
Unique type identifier for any non-static type (unlike `core::any::Any`)## Usage
```rust
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: https://github.com/rust-lang/rust/issues/27086
## License
MIT