| Crates.io | pub_source |
| lib.rs | pub_source |
| version | 0.1.2 |
| created_at | 2025-12-04 21:45:12.744791+00 |
| updated_at | 2025-12-05 03:48:39.668555+00 |
| description | Make everything public |
| homepage | |
| repository | https://github.com/TabulateJarl8/pub_source |
| max_upload_size | |
| id | 1967094 |
| size | 57,602 |
pub_source - Make Everything Public
pub_source provides the make_public! procedural macro, which rewrites a block of Rust source code so that all top level items become public.
This macro parses the input as a full syn::File and rewrites the following kinds of items to pub:
Non-items such as use, macros, or foreign modules are left unchanged.
This crate also denies the use of unwrap, expect, and panic!().
cargo add pub_source
Then the crate can be used as follows:
pub_source::make_public! {
fn hidden() {}
struct Thing {
a: u32,
b: String,
}
impl Thing {
fn show(&self) {
println!("{}", self.b);
}
}
}
Expands to code equivalent to:
pub fn hidden() {}
pub struct Thing {
pub a: u32,
pub b: String,
}
impl Thing {
pub fn show(&self) {
println!("{}", self.b);
}
}
This was originally written to be injected around user-submitted code in a code runner so that unit tests could access everything the user wrote. There may be other uses but I'm not quite sure what they might be yet.
This crate provides two feature flags:
std - used for enabling stdlib support, enabled by defaultunstable - used for enabling unstable features (trait aliases, impl-associated types) on nightly compilers that are using these featuresThis crate is licensed under the MIT license