Crates.io | malloced |
lib.rs | malloced |
version | 1.3.1 |
source | src |
created_at | 2020-12-13 04:19:24.588109 |
updated_at | 2023-02-27 13:49:14.734709 |
description | A malloc-ed box pointer type. |
homepage | https://github.com/nvzqz/malloced |
repository | https://github.com/nvzqz/malloced |
max_upload_size | |
id | 322318 |
size | 39,544 |
A malloc
-ed box pointer type, brought to you by
@NikolaiVazquez!
If this project is useful to you, please consider sponsoring me or donating directly!
Doing so enables me to create high-quality open source software like this. ❤️
This library is available on crates.io and
can be used by adding the following to your project's
Cargo.toml
:
[dependencies]
malloced = "1.3.1"
The star of the show is Malloced
, Box
-like pointer that calls free
on
Drop
:
use malloced::Malloced;
This library's minimum supported Rust version (MSRV) is 1.64. A new version requirement would result in a minor version update.
Malloced<T>
is a #[repr(transparent)]
wrapper over NonNull<T>
, so it can
be safely used in C FFI. For example, the following is safe and even compiles
with the improper_ctypes
lint enabled:
#[deny(improper_ctypes)]
extern "C" {
fn my_array_malloc() -> Malloced<[u8; 32]>;
}
This project is released under either MIT License or Apache License (Version 2.0) at your choosing.