3 releases (breaking)

0.3.0 Feb 11, 2023
0.2.2 Feb 11, 2023
0.2.1 Jan 24, 2023
0.2.0 Jan 23, 2023
0.1.0 Jan 11, 2023

#634 in Procedural macros

Download history 2395/week @ 2024-03-14 2638/week @ 2024-03-21 1702/week @ 2024-03-28 2384/week @ 2024-04-04 3209/week @ 2024-04-11 2645/week @ 2024-04-18 1483/week @ 2024-04-25 2131/week @ 2024-05-02 2015/week @ 2024-05-09 1388/week @ 2024-05-16 954/week @ 2024-05-23 1060/week @ 2024-05-30 1180/week @ 2024-06-06 1129/week @ 2024-06-13 1375/week @ 2024-06-20 882/week @ 2024-06-27

4,856 downloads per month
Used in 8 crates (2 directly)

MIT license

16KB
344 lines

cfg-vis

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(crate)`.
#[cfg_vis(target_os = "linux", pub(crate))]
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,
}

Dependencies

~3.5MB
~75K SLoC