Crates.io | puball |
lib.rs | puball |
version | 0.1.1 |
source | src |
created_at | 2022-08-08 13:30:32.307456 |
updated_at | 2022-08-08 15:12:09.510918 |
description | Public all the field in your struct |
homepage | |
repository | https://github.com/Avimitin/puball |
max_upload_size | |
id | 640844 |
size | 16,385 |
A simple API that help you generate struct with all fields public.
A friend of mine wrote a huge struct with 71 pub
keywords.
It's too hard to write so much pub
keywords.
Especially when you realize that your forgot to add those visbilty
after you finish the sturct design.
# Cargo.toml
[dependencies]
puball = "0.1"
mod my_space {
use puball::pub_all;
pub_all!{
pub struct NoPrivacy {
a: i32,
b: String,
c: bool,
}
}
}
fn main() {
use my_space::NoPrivacy;
let np = NoPrivacy {
a: 1,
b: String::new(),
c: true,
};
assert_eq!(1, np.a);
assert!(np.c);
}