From 8422e0ada52d8036c32257d84f069776e520079e Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sun, 3 May 2026 01:31:04 +0800 Subject: Add missing articles and improve documentation --- mingling_core/src/debug.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'mingling_core/src/debug.rs') diff --git a/mingling_core/src/debug.rs b/mingling_core/src/debug.rs index 9fd553c..f92cd3d 100644 --- a/mingling_core/src/debug.rs +++ b/mingling_core/src/debug.rs @@ -1,4 +1,6 @@ #[macro_export] +/// A macro that only executes the given expressions when the `debug` feature is enabled. +/// If the feature is not enabled, the expressions are compiled away. macro_rules! only_debug { ($($expr:expr);* $(;)?) => { #[cfg(feature = "debug")] @@ -9,6 +11,8 @@ macro_rules! only_debug { } #[macro_export] +/// Logs a message at the trace level, but only if the `debug` feature is enabled. +/// Delegates to `log::trace!` internally. macro_rules! trace { ($($arg:tt)*) => { $crate::only_debug! { @@ -18,6 +22,8 @@ macro_rules! trace { } #[macro_export] +/// Logs a message at the debug level, but only if the `debug` feature is enabled. +/// Delegates to `log::debug!` internally. macro_rules! debug { ($($arg:tt)*) => { $crate::only_debug! { @@ -27,6 +33,8 @@ macro_rules! debug { } #[macro_export] +/// Logs a message at the info level, but only if the `debug` feature is enabled. +/// Delegates to `log::info!` internally. macro_rules! info { ($($arg:tt)*) => { $crate::only_debug! { @@ -36,6 +44,8 @@ macro_rules! info { } #[macro_export] +/// Logs a message at the warn level, but only if the `debug` feature is enabled. +/// Delegates to `log::warn!` internally. macro_rules! warn { ($($arg:tt)*) => { $crate::only_debug! { @@ -45,6 +55,8 @@ macro_rules! warn { } #[macro_export] +/// Logs a message at the error level, but only if the `debug` feature is enabled. +/// Delegates to `log::error!` internally. macro_rules! error { ($($arg:tt)*) => { $crate::only_debug! { -- cgit