c_struct_layout

Crates.ioc_struct_layout
lib.rsc_struct_layout
version0.1.1
sourcesrc
created_at2024-11-06 20:27:24.426949
updated_at2024-11-06 20:49:33.74102
descriptionA library for enforcing stable, C-compatible data layouts in Rust.
homepagehttps://github.com/bensatlantik/c_struct_layout
repositoryhttps://github.com/bensatlantik/c_struct_layout
max_upload_size
id1438836
size4,055
Ben Santora (bensatlantik)

documentation

README

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

Ben Santora bensatlantik@gmail.com

Donate

https://bensatlantik.github.io/

Commit count: 5

cargo fmt