Registry / utility / uninit

uninit

JSON →
library0.6.2rscratesunverified

A collection of tools for a safer usage of uninitialized memory in Rust.

# Cargo.toml [dependencies] uninit = "0.6.2"
INSTALL
IMPORT
SIG · UNINIT
U
uninit
utilityrustv0.6.2
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.

Uninit
✓ use uninit::Uninit;

Demonstrates creating an uninitialized array and safely initializing it.

use uninit::Uninit; fn main() { let mut uninit: Uninit<[u8; 1024]> = Uninit::uninit(); unsafe { uninit.as_mut_ptr().write([0u8; 1024]); } let initialized = unsafe { uninit.assume_init() }; println!("Initialized array length: {}", initialized.len()); }
Debug
Known issues
gotchaUsing uninitialized memory incorrectly can lead to undefined behavior.
fix
Ensure all bytes are properly initialized before calling assume_init.
affects: >=0.6.0
Upgrade
Version history
0.6.2latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
10
Resources
uninit — cargo add uninit · libregistry