c_struct_layout

Crates.ioc_struct_layout
lib.rsc_struct_layout
version0.1.3
sourcesrc
created_at2024-11-06 20:27:24.426949
updated_at2024-11-21 02:51:18.335881
descriptionA library for enforcing stable, C-compatible data layouts in Rust.
homepage
repository
max_upload_size
id1438836
size3,737
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

bensatlantik

Commit count: 0

cargo fmt