| Crates.io | pubs |
| lib.rs | pubs |
| version | 0.1.0 |
| created_at | 2025-08-25 20:47:58.996159+00 |
| updated_at | 2025-08-25 20:47:58.996159+00 |
| description | This crate simply adds pub for you on your struct or impl functions. |
| homepage | |
| repository | https://github.com/StrongTheDev/pubs |
| max_upload_size | |
| id | 1810118 |
| size | 6,570 |
This crate simply adds pub for you on your struct or impl functions.
// main.rs
use models::Test;
mod models {
use pubs::{PubSkip, pub_methods, pub_struct};
#[derive(PubSkip)] // Helps you use the "#[skip]" attribute to skip making a given field public
#[pub_struct]
struct Test {
name: String,
#[skip] // This makes age private (the default)
age: u8,
}
#[pub_methods]
impl Test {
fn new(n: &str, a: u8) -> Self {
Self {
name: n.into(),
age: a,
}
}
}
}
fn main() {
let _human = Test::new("Strong the dev", 255);
}