make_public

Crates.iomake_public
lib.rsmake_public
version0.1.0
created_at2025-02-06 15:29:08.546713+00
updated_at2025-02-06 15:29:08.546713+00
descriptionA procedural macro to make struct fields public
homepage
repositoryhttps://github.com/rgunindi/make_public
max_upload_size
id1545752
size5,998
Ramazan (rgunindi)

documentation

https://docs.rs/make_public

README

make_public

make_public is a procedural macro attribute for Rust that automatically makes all fields in a struct public.

Installation

Add this to your Cargo.toml:

[dependencies]
make_public = "0.1.0"

Usage

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);
}

Features

  • Makes all fields in a struct public
  • Works with any field type
  • Preserves other attributes (like derive)
  • Simple and easy to use

Running Tests

cargo test

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Commit count: 2

cargo fmt