Thanks to visit codestin.com
Credit goes to github.com

Skip to content

zakarumych/vtid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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 HasVtid trait for your types.
  • no_std Compatible: Use in embedded and other no_std environments.
  • Minimal Dependencies: Zero dependencies, except for the derive macro.

πŸ“¦ Installation

Add vtid to your Cargo.toml:

[dependencies]
vtid = { version = "0.1.0", features = ["derive"] }

πŸ› οΈ Usage

Here's how to use vtid in your project:

use vtid::{Vtid, HasVtid};

// Derive HasVtid for your types
#[derive(HasVtid)]
struct MyType;

// Get the volatile type ID
let type_id = Vtid::of::<MyType>();
println!("Type ID: {:?}", type_id);

// IDs change when crate is recompiled
let id1 = Vtid::of::<MyType>();

// Restart the program.
let id2 = Vtid::of::<MyType>(); // Same as id1

// Recompile program, but this crate and deps are not changed, so rlib is reused.
let id3 = Vtid::of::<MyType>(); // Should be the same as id1

// After this crate recompilation...
let id4 = Vtid::of::<MyType>(); // Different from id1

πŸ“œ License

Licensed under either of

at your option.

About

Volatile Type ID for Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages