Registry / utility / safe-transmute

safe-transmute

JSON →
library0.11.3rscratesunverified

Provides a safeguarded transmute() function for Rust with safety checks.

# Cargo.toml [dependencies] safe-transmute = "0.11.3"
INSTALL
IMPORT
SIG · SAFE-TRANSMUTE
S
safe-transmute
utilityrustv0.11.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

transmute
use safe_transmute::transmute;

Transmutes a byte array into a u32 value safely.

use safe_transmute::transmute; fn main() { let bytes: [u8; 4] = [0x01, 0x02, 0x03, 0x04]; let value: u32 = transmute(bytes).unwrap(); println!("{}", value); }
Debug
Known issues
gotchaTransmute may fail if the source and target types have incompatible sizes or alignment.
fix
Ensure the types have the same size and alignment; use try_transmute for fallible cases.
affects: >=0.1.0
Upgrade
Version history
0.11.3latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
safe-transmute — cargo add safe-transmute · libregistry