Crates.io | cfg-vis |
lib.rs | cfg-vis |
version | 0.2.2 |
source | src |
created_at | 2023-01-11 15:15:10.505215 |
updated_at | 2023-02-11 09:40:48.728814 |
description | A macro to support `#[cfg()]` on visibility. |
homepage | |
repository | https://github.com/TOETOE55/cfg-vis |
max_upload_size | |
id | 756477 |
size | 13,461 |
A macro to support #[cfg()]
on visibility.
use cfg_vis::{cfg_vis, cfg_vis_fields};
// default visibility is `pub`, while the target is linux, the visibility is `pub(super)`.
#[cfg_vis(target_os = "linux", pub(super))]
pub fn foo() {}
#[cfg_vis_fields]
pub struct Foo {
#[cfg_vis(test, pub)]
pub_in_test: i32,
#[cfg_vis(test)]
pub prv_in_test: i32,
}