#visibility #pub #override #conditional #compilation

macro visibility

Attribute to override the visibility of items (useful in conjunction with cfg_attr)

2 releases

0.0.1 Mar 6, 2021
0.0.0 Mar 6, 2021

#4 in #override

Download history 1062/week @ 2023-02-13 1020/week @ 2023-02-20 1127/week @ 2023-02-27 1522/week @ 2023-03-06 1021/week @ 2023-03-13 1046/week @ 2023-03-20 1354/week @ 2023-03-27 974/week @ 2023-04-03 1150/week @ 2023-04-10 1340/week @ 2023-04-17 1425/week @ 2023-04-24 991/week @ 2023-05-01 1334/week @ 2023-05-08 1253/week @ 2023-05-15 1668/week @ 2023-05-22 1417/week @ 2023-05-29

5,736 downloads per month
Used in 21 crates (9 directly)

Zlib OR MIT OR Apache-2.0

6KB

#[visibility::make]

Repository Latest version Documentation MSRV unsafe forbidden License CI

Attribute to override the visibility of items (especially useful in conjunction with #[cfg_attr()]).

Since it is currently not possible to conditionally modify the visibility of an item, but since it is possible to conditionally apply an attribute, this crate features a trivial attribute that modifies the visibility of the decorated item. This way, by conditionally applying it, one can achieve the desired goal:

Example

/// Some fancy docs.
///
/// ## Example
///
/// ```rust
/// ::my_crate::module::foo();
/// ```
// Assuming `cargo test --doc --features integration-tests` is run:
#[cfg_attr(feature = "integration-tests", visibility::make(pub))]
mod module {
    pub fn foo() {}
}

Dependencies

~0.9–1.2MB
~30K SLoC