Crates.io | visibility |
lib.rs | visibility |
version | 0.1.0 |
source | src |
created_at | 2021-03-06 20:13:01.291206 |
updated_at | 2023-09-02 17:45:48.9314 |
description | Attribute to override the visibility of items (useful in conjunction with cfg_attr) |
homepage | https://crates.io/crates/visibility |
repository | https://github.com/danielhenrymantilla/visibility.rs |
max_upload_size | |
id | 364924 |
size | 9,992 |
#[visibility::make]
#[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:
/// 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() {}
}