ps

Crates.iops
lib.rsps
version0.1.0
sourcesrc
created_at2018-09-15 06:04:17.651289
updated_at2018-09-15 06:04:17.651289
descriptionA safe wrapper around `std::mem::transmute`
homepage
repositoryhttps://github.com/lfairy/ps
max_upload_size
id84814
size17,884
Chris Wong (lambda-fairy)

documentation

https://docs.rs/ps/

README

The Philosopher's Stone

This is a proof-of-concept library that lets you cast between arbitrary types in a safe way. In other words, it's a safe std::mem::transmute!

Example

let mut string_map: HashMap<u32, String> = HashMap::new();
string_map.insert(42, "world".into());

let bytes_map: HashMap<u32, Vec<u8>> =
    ps::hash_map_values(ps::string_bytes()).cast(string_map);

assert_eq!(map[42], b"world");
Commit count: 2

cargo fmt