uninit_buffers

Crates.iouninit_buffers
lib.rsuninit_buffers
version0.1.1
created_at2025-07-02 19:44:13.45967+00
updated_at2025-07-02 19:48:14.001782+00
descriptionSafe uninitialized buffers that take input from functions or iterators.
homepagehttps://jamespetersen.ca/uninit_buffers
repositoryhttps://github.com/ljtpetersen/uninit_buffers
max_upload_size
id1735514
size43,463
James Petersen (ljtpetersen)

documentation

README

uninit_buffers   Build Status latest version docs passing

This crate aims to fill a hole in the currently-unstable MaybeUninit slice-filling API: there is a safe way to fill a slice, but there is no safe way to drop elements of the slice. For this purpose, we introduce a wrapper type, Initialized, which will drop the initialized elements when it goes out of scope.

Regarding safety, we treat the Initialized structure as if it owns the elements thar are filled. It is instantiated by using the SliceExt trait, which is implemented on all MaybeUninit slices.

Usage

This crate is on crates.io and can beused by executing cargo add uninit_buffers or by adding the following to the dependencies in your Cargo.toml file.

[dependencies]
uninit_buffers = "0.1"

Licensing

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Feel free to put a copyright header in your name in any files you contribute to.

Copyright and Credits

Copyright (C) 2025 James Petersen m@jamespetersen.ca.

The SliceExt trait implementation and documentation on MaybeUninit slices is heavily influenced (mostly copied) from the corresponding implementation in the Rust standard library, with minor adjustments where necessary to accomodate the Initialized structure as well as any missing unstable features.

Commit count: 0

cargo fmt