Trait serde_dyn::TypeUuid

source ·
pub trait TypeUuid {
    const UUID: u128;
}
Expand description

Provides a statically defined UUID for a Rust type. It’s recommended to implement this by generating a v4 UUID, and transmuting it into a u128. Here’s an example of how to do so

extern crate uuid;
use std::mem::transmute;
use uuid::Uuid;

fn main() {
    println!("{}", unsafe {transmute::<[u8; 16], u128>(*Uuid::new_v4().as_bytes())});
}

All types registered with the TUSM must have a unique value provided for this trait.

Required Associated Constants§

Implementations on Foreign Types§

Implementors§