make_public 0.1.0

A procedural macro to make struct fields public
Documentation
  • Coverage
  • 0%
    0 out of 2 items documented0 out of 1 items with examples
  • Size
  • Source code size: 5.48 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 276.83 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 6s Average build duration of successful builds.
  • all releases: 6s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • rgunindi/make_public
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • rgunindi

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.