7 releases (breaking)

0.7.0 Nov 28, 2024
0.6.0 Jan 3, 2024
0.5.0 Jul 29, 2023
0.4.0 May 7, 2023
0.1.0 Apr 7, 2023

#882 in Rust patterns

Download history 15/week @ 2024-09-23 131/week @ 2024-11-25 6/week @ 2024-12-02 56/week @ 2024-12-09

193 downloads per month

Unlicense

21KB
331 lines

maybe-uninit-ext

crates.io docs.rs Dependency Status Unlicense Minimum Supported Rust Version is 1.83

Extended maybe-uninit types.


lib.rs:

crates.io Dependency Status Unlicense Minimum Supported Rust Version is 1.83

Extended maybe-uninit types.

Example

// Creates a 4x4 grid of `MaybeUninit` values.
let mut grid = maybe_uninit_ext::uninit::<[[MaybeUninit<usize>; 4]; 4]>();
grid.iter_mut().enumerate().for_each(|(i, row)| {
    row.iter_mut().enumerate().for_each(|(j, tile)| {
        tile.write(i * j);
    });
});

// SAFETY: The grid was fully initialized.
let grid = unsafe { maybe_uninit_ext::assume_init(grid) };
assert_eq!(
    grid,
    [[0, 0, 0, 0], [0, 1, 2, 3], [0, 2, 4, 6], [0, 3, 6, 9]],
);

Minimum supported Rust version

The MSRV is currently 1.83.

This may change between minor versions.

License

I release this crate into the public domain under the Unlicense.

No runtime deps