Crates.io | c_struct_layout |
lib.rs | c_struct_layout |
version | 0.1.1 |
source | src |
created_at | 2024-11-06 20:27:24.426949 |
updated_at | 2024-11-06 20:49:33.74102 |
description | A library for enforcing stable, C-compatible data layouts in Rust. |
homepage | https://github.com/bensatlantik/c_struct_layout |
repository | https://github.com/bensatlantik/c_struct_layout |
max_upload_size | |
id | 1438836 |
size | 4,055 |
A library for enforcing stable, C-compatible data layouts in Rust.
#[repr(C)]
.check_layout
method to verify the layout at runtime (basic implementation).To use c_struct_layout
, add the following to your Cargo.toml
:
[dependencies]
c_struct_layout = "0.1.0"
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.
This project is licensed under the MIT License
Ben Santora bensatlantik@gmail.com