Skip to content
!! PROOF OF CONCEPT DO NOT USE !! The Philosopher's Stone — a library that makes `std::mem::transmute` safe
Rust
Branch: master
Clone or download
Latest commit 27e247a Sep 15, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src 🌅 Initial commit Sep 15, 2018
tests 🌅 Initial commit Sep 15, 2018
.gitignore 🌅 Initial commit Sep 15, 2018
.travis.yml Travis Sep 15, 2018
Cargo.toml 🌅 Initial commit Sep 15, 2018
LICENSE-APACHE 🌅 Initial commit Sep 15, 2018
LICENSE-MIT 🌅 Initial commit Sep 15, 2018
README.md 🌅 Initial commit Sep 15, 2018

README.md

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");
You can’t perform that action at this time.