Crates.io | disable_macro |
lib.rs | disable_macro |
version | 0.3.6 |
source | src |
created_at | 2024-06-21 20:14:31.987059 |
updated_at | 2024-06-21 21:40:42.204892 |
description | This simple crate lets us disable a block of code with an attribute #[disable]. |
homepage | |
repository | https://github.com/klebs6/klebs-general |
max_upload_size | |
id | 1279898 |
size | 4,124 |
disable
is a Rust procedural macro that allows you to conditionally disable blocks of code by completely removing them. This can be useful for debugging, feature gating, or simply turning off certain functionalities during development.
This is mostly useful (IMO) for easily disabling tests without block comments.
Add disable
as a dependency in your Cargo.toml
:
[dependencies]
disable = "*"
Annotate the functions you want to disable with the #[disable] attribute
use disable::disable;
#[disable]
fn some_function() {
println!("This code will not be compiled.");
}
// this will not compile, because `some_function` is disabled
fn main() {
some_function();
}
This project is licensed under the MIT License. See the LICENSE file for details.