uninit_buffers 0.1.1

Safe uninitialized buffers that take input from functions or iterators.
Documentation
  • Coverage
  • 100%
    12 out of 12 items documented8 out of 11 items with examples
  • Size
  • Source code size: 42.95 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 4.49 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 14s Average build duration of successful builds.
  • all releases: 13s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • ljtpetersen/uninit_buffers
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ljtpetersen

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.