4 releases
new 0.1.3 | Nov 21, 2024 |
---|---|
0.1.2 | Nov 21, 2024 |
0.1.1 | Nov 6, 2024 |
0.1.0 | Nov 6, 2024 |
#568 in Procedural macros
242 downloads per month
4KB
c_struct_layout
A library for enforcing stable, C-compatible data layouts in Rust.
Features
- Ensure consistent, C-compatible memory layouts for structs using
#[repr(C)]
. - Provides a
check_layout
method to verify the layout at runtime (basic implementation).
Installation
To use c_struct_layout
, add the following to your Cargo.toml
:
[dependencies]
c_struct_layout = "0.1.0"
Usage
use c_struct_layout::CStructLayout;
#[derive(CStructLayout)]
#[repr(C)]
struct MyData {
x: u32,
y: f64,
}
fn main() {
MyData::check_layout();
}
The check_layout method is a placeholder for verifying struct layouts. You can expand it with more detailed checks if needed.
License
This project is licensed under the MIT License
Author
bensatlantik
Dependencies
~1.5MB
~37K SLoC