box_raw_ptr
box_raw_ptr is a Rust library designed to provide safe wrappers for handling raw pointers *const T and *mut T. The library ensures memory safety by encapsulating these raw pointers within safe abstractions, leveraging Rust's ownership and borrowing rules.
All heap allocations in this library utilize malloc and free, ensuring compatibility with C FFI (Foreign Function Interface). This approach allows seamless integration with C while maintaining safety through Rust's type system and ownership model. The raw pointers defined in Rust that are not imported from C will still be compatable.
The Box<T> wrapper around the raw pointers by box_raw_ptr ensures that operations on raw pointers are safe and aligned with Rust's memory safety principles. This makes it easier to work with raw pointers in Rust codebases, especially when interfacing with C libraries or performing low-level memory management tasks.
By combining the power of Rust's safety features with the flexibility of raw pointers, box_raw_ptr facilitates robust and secure memory management in Rust applications.
Features
- ConstRawPtr: A wrapper for
*const Tproviding methods for safely working with constant raw pointers. - MutRawPtr: A wrapper for
*mut Tproviding methods for safely working with mutable raw pointers.
Example
use ;