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

#731 in Procedural macros

Download history 782/week @ 2024-07-27 1240/week @ 2024-08-03 847/week @ 2024-08-10 1362/week @ 2024-08-17 1161/week @ 2024-08-24 1782/week @ 2024-08-31 1448/week @ 2024-09-07 1091/week @ 2024-09-14 1609/week @ 2024-09-21 1238/week @ 2024-09-28 1418/week @ 2024-10-05 1718/week @ 2024-10-12 1161/week @ 2024-10-19 1098/week @ 2024-10-26 908/week @ 2024-11-02 644/week @ 2024-11-09

4,020 downloads per month
Used in 11 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
~77K SLoC