Crates.io | public |
lib.rs | public |
version | 0.2.2 |
source | src |
created_at | 2020-09-22 03:54:39.671723 |
updated_at | 2021-08-20 15:01:21.29878 |
description | A attribute macro used to mark struct/union and its fields as public |
homepage | https://github.com/yuchunzhou/public |
repository | https://github.com/yuchunzhou/public |
max_upload_size | |
id | 291402 |
size | 40,585 |
A Rust attribute macro used to mark struct/union and its fields as public
add the dependency to your Cargo.toml
[dependencies]
public = { git = "https://github.com/yuchunzhou/public", branch = "main" }
then, mark the struct with public
attribute macro
#[macro_use]
extern crate public;
#[public]
#[derive(Debug, Default)]
struct Foo {
a: i8,
b: char,
c: String,
}
the struct Foo
and its fields will be visible within the current crate(default scope), of course, you can pass other scope arguments to the public
attribute macro, like the usage of pub
keyword in Rust.