| Crates.io | make_public |
| lib.rs | make_public |
| version | 0.1.0 |
| created_at | 2025-02-06 15:29:08.546713+00 |
| updated_at | 2025-02-06 15:29:08.546713+00 |
| description | A procedural macro to make struct fields public |
| homepage | |
| repository | https://github.com/rgunindi/make_public |
| max_upload_size | |
| id | 1545752 |
| size | 5,998 |
make_public is a procedural macro attribute for Rust that automatically makes all fields in a struct public.
Add this to your Cargo.toml:
[dependencies]
make_public = "0.1.0"
use make_public::make_public;
// All fields will be public
#[make_public]
struct MyStruct {
field1: String,
field2: i32,
field3: bool,
}
fn main() {
let my_struct = MyStruct {
field1: String::from("Hello"),
field2: 42,
field3: true,
};
// Fields are accessible from outside
println!("{}", my_struct.field1);
}
derive)cargo test
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.