Skip to content

A macro to support `#[cfg()]` on visibility.

License

Notifications You must be signed in to change notification settings

mu001999-contrib/cfg-vis

This branch is 3 commits behind TOETOE55/cfg-vis:master.

Repository files navigation

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,
}

About

A macro to support `#[cfg()]` on visibility.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%