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

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

#31 in #usize

Download history 21/week @ 2024-03-11 6/week @ 2024-03-18 33/week @ 2024-03-25 8/week @ 2024-04-01 7/week @ 2024-04-08 8/week @ 2024-04-15 1/week @ 2024-05-13 17/week @ 2024-05-20 21/week @ 2024-05-27 39/week @ 2024-06-03 27/week @ 2024-06-10 37/week @ 2024-06-17 56/week @ 2024-06-24

160 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

~280–730KB
~17K SLoC