vtid - Volatile Type ID
A Rust library for generating volatile type IDs that change when a crate is recompiled.
🚀 Features
- Extended Type IDs: Generate extended type IDs that change with each crate recompilation.
- Derive Macro Support: Easily derive the
HasVtidtrait for your types. no_stdCompatible: Use in embedded and otherno_stdenvironments.- Minimal Dependencies: Zero dependencies, except for the derive macro.
📦 Installation
Add vtid to your Cargo.toml:
[]
= { = "0.1.0", = ["derive"] }
🛠️ Usage
Here's how to use vtid in your project:
use ;
// Derive HasVtid for your types
;
// Get the volatile type ID
let type_id = ;
println!;
// IDs change when crate is recompiled
let id1 = ;
// Restart the program.
let id2 = ; // Same as id1
// Recompile program, but this crate and deps are not changed, so rlib is reused.
let id3 = ; // Should be the same as id1
// After this crate recompilation...
let id4 = ; // Different from id1
📜 License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.