#attributes #struct-fields #public #usize #proc #proc-macro #proc-macro-attributes

macro pub-fields

Provides a proc macro attribute that defaults all struct fields to public

2 releases

0.1.1 Jul 5, 2023
0.1.0 Jul 5, 2023

#28 in #usize

Download history 12/week @ 2024-07-20 74/week @ 2024-07-27 26/week @ 2024-08-03 44/week @ 2024-08-10 55/week @ 2024-08-17 38/week @ 2024-08-24 62/week @ 2024-08-31 94/week @ 2024-09-07 107/week @ 2024-09-14 64/week @ 2024-09-21 67/week @ 2024-09-28 94/week @ 2024-10-05 59/week @ 2024-10-12 76/week @ 2024-10-19 105/week @ 2024-10-26 142/week @ 2024-11-02

386 downloads per month
Used in shame

MIT license

3KB

A simple attribute that makes all fields public on a struct.

Usage:

#[pub_fields]
pub struct MyStruct {
    a: usize,
    b: usize,
    c: usize,
}

=>

pub struct MyStruct {
    pub a: usize,
    pub b: usize,
    pub c: usize,
}

Dependencies

~225–670KB
~16K SLoC