Crate safe_transmute [−] [src]
This crate contains checked implementations of transmute()
.
Examples
View bytes as a series of u16
s:
assert_eq!(guarded_transmute_many::<u16>(&[0x00, 0x01, 0x12, 0x34, // Spare byte, unused 0x00]), &[0x0100, 0x3412]);
View bytes as an f64
:
assert_eq!(guarded_transmute::<f64>(&[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]), 0.0);
Functions
guarded_transmute |
Transmute a byte slice into a single instance of a |
guarded_transmute_many |
View a byte slice as a slice of an arbitrary type. |