raw-transmute 1.0.0

A more permissive alternative to mem::transmute, because you know better.
Documentation
  • Coverage
  • 100%
    7 out of 7 items documented2 out of 4 items with examples
  • Size
  • Source code size: 13.13 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.02 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Aseminaunz

Raw Transmute

crates.io docs.rs license repository no-std

Rust's own built-in transmute is, ironically, quite limited.

It does not support generically-sized types, nor types with different sizes. This crate provides a more permissive alternative through the use of unions:

  • raw_transmute to unsafely transmute between any two types, regardless of size or genericity.
  • raw_transmute_uninit to safely transmute into a MaybeUninit of the destination type.

The MSRV for this crate is Rust 1.31. However, some features require later versions:

  • Transmuting into MaybeUninit requires Rust 1.36 or later.
  • Transmuting for non-Copy types requires Rust 1.49 or later.
  • const support for both functions requires Rust 1.56 or later.