Skip to content

Home for the Rust pubs crate. This crate simply adds pub for you on your struct or impl functions.

Notifications You must be signed in to change notification settings

StrongTheDev/pubs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PUBS.

This crate simply adds pub for you on your struct or impl functions.

Example usage:

// 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);
}

About

Home for the Rust pubs crate. This crate simply adds pub for you on your struct or impl functions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages