conditional-mod 0.1.0

Simple rust macro for conditional module visibility
Documentation
  • Coverage
  • 50%
    1 out of 2 items documented0 out of 0 items with examples
  • Size
  • Source code size: 13.94 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 107.35 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • apfitzge/conditional-mod
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • apfitzge

conditional-mod

Provides a simple macro conditional_vis_mod to change module visibility based on a condition.

Usage

Assume there is some module file my_module.rs. The visibility of the module can be changed based on conditions, such as compiler features:

// This will declare the module as public if "my_feature" is active, and private otherwise.
conditional_mod::conditional_vis_mod!(my_module, feature = "my_feature", pub);

// This will declare the module as public if "my_feature" is not active, and `pub(crate)` otherwise.
conditional_mod::conditional_vis_mod!(my_module, feature = "my_feature", pub, pub(crate));