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

#461 in Procedural macros

Download history 2301/week @ 2024-01-24 1834/week @ 2024-01-31 1511/week @ 2024-02-07 1568/week @ 2024-02-14 1762/week @ 2024-02-21 2139/week @ 2024-02-28 2082/week @ 2024-03-06 2437/week @ 2024-03-13 2590/week @ 2024-03-20 1780/week @ 2024-03-27 2217/week @ 2024-04-03 2964/week @ 2024-04-10 3000/week @ 2024-04-17 1605/week @ 2024-04-24 1962/week @ 2024-05-01 1762/week @ 2024-05-08

9,000 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
~73K SLoC