Skip to content

VanOvermeire/make-structs-public-macro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Make Public Macro

Rust macro that makes all the fields of a struct public.

I did not publish this code as a crate because I noticed something like this already exists.

// somewhere in your `main.rs`:
#[macro_use]
extern crate make_fields_public;

// ...

#[public]
struct Example {
    first: i32,
    second: i32,
}

Will change the given struct into:

pub struct Example {
    pub first: i32,
    pub second: i32,
}

Also see test_structs.rs.

Nested structs

If you want nested structs to also be visible, make sure to add the macro to these nested structs as well. Again, see the examples in test_structs.rs.

About

Macro that makes structs and their fields public

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages