diff --git a/plugins/crisp/src/filter.rs b/plugins/crisp/src/filter.rs index ee4eceed..6dc1359c 100644 --- a/plugins/crisp/src/filter.rs +++ b/plugins/crisp/src/filter.rs @@ -14,6 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +use nih_plug::debug::*; use std::f32::consts; use std::ops::{Add, Mul, Sub}; diff --git a/plugins/crisp/src/lib.rs b/plugins/crisp/src/lib.rs index 718cfa78..d199b01a 100644 --- a/plugins/crisp/src/lib.rs +++ b/plugins/crisp/src/lib.rs @@ -14,9 +14,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#[macro_use] -extern crate nih_plug; - use nih_plug::prelude::*; use nih_plug_vizia::ViziaState; use pcg::Pcg32iState; diff --git a/plugins/diopser/src/filter.rs b/plugins/diopser/src/filter.rs index fcb0e6ff..ff5ab85e 100644 --- a/plugins/diopser/src/filter.rs +++ b/plugins/diopser/src/filter.rs @@ -14,6 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +use nih_plug::debug::nih_debug_assert; use std::f32::consts; use std::ops::{Add, Mul, Sub}; use std::simd::f32x2; diff --git a/plugins/diopser/src/lib.rs b/plugins/diopser/src/lib.rs index cdac626e..4f55a2d3 100644 --- a/plugins/diopser/src/lib.rs +++ b/plugins/diopser/src/lib.rs @@ -19,9 +19,6 @@ #[cfg(not(feature = "simd"))] compile_error!("Compiling without SIMD support is currently not supported"); -#[macro_use] -extern crate nih_plug; - use nih_plug::prelude::*; use nih_plug_vizia::ViziaState; use std::simd::f32x2; diff --git a/plugins/loudness_war_winner/src/filter.rs b/plugins/loudness_war_winner/src/filter.rs index 92e510a6..1a10d9b0 100644 --- a/plugins/loudness_war_winner/src/filter.rs +++ b/plugins/loudness_war_winner/src/filter.rs @@ -14,6 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +use nih_plug::debug::*; use std::f32::consts; use std::ops::{Add, Mul, Sub}; diff --git a/plugins/loudness_war_winner/src/lib.rs b/plugins/loudness_war_winner/src/lib.rs index 17408c5d..2852bb4f 100644 --- a/plugins/loudness_war_winner/src/lib.rs +++ b/plugins/loudness_war_winner/src/lib.rs @@ -14,9 +14,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#[macro_use] -extern crate nih_plug; - use nih_plug::prelude::*; use std::sync::Arc; diff --git a/src/debug.rs b/src/debug.rs index 46a984a2..dc974be5 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -1,3 +1,8 @@ +// NOTE: Exporting macros in Rust is a bit weird. `#[macro_export]` causes them to be exported to +// the crate root, but that makes it difficult to include just the macros without using +// `#[macro_use] extern crate nih_plug;`. That's why the macros are also re-exported from this +// module. + /// Write something to the logger. This defaults to STDERR unless the user is running Windows and a /// debugger has been attached, in which case `OutputDebugString()` will be used instead. /// @@ -14,6 +19,7 @@ macro_rules! nih_log { $crate::log::info!($($args)*) ); } +pub use nih_log; /// The same as `nih_log!()`, but with source and thread information. Like the /// `nih_debug_assert*!()` macros, this is only shown when compiling in debug mode. @@ -23,6 +29,7 @@ macro_rules! nih_trace { $crate::util::permit_alloc(|| $crate::log::trace!($($args)*)) ); } +pub use nih_trace; /// Analogues to the `dbg!()` macro, but respecting the `NIH_LOG` environment variable and with all /// of the same logging features as the other `nih_*!()` macros. Like the `nih_debug_assert*!()` @@ -44,6 +51,7 @@ macro_rules! nih_dbg { }; ($($val:expr),+ $(,)?) => { ($($crate::nih_dbg!($val)),+,) }; } +pub use nih_dbg; /// A `debug_assert!()` analogue that prints the error with line number information instead of /// panicking. @@ -62,6 +70,7 @@ macro_rules! nih_debug_assert { } ); } +pub use nih_debug_assert; /// An unconditional debug assertion failure, for if the condition has already been checked /// elsewhere. @@ -78,6 +87,7 @@ macro_rules! nih_debug_assert_failure { } ); } +pub use nih_debug_assert_failure; /// A `debug_assert_eq!()` analogue that prints the error with line number information instead of /// panicking. @@ -94,6 +104,7 @@ macro_rules! nih_debug_assert_eq { } ); } +pub use nih_debug_assert_eq; /// A `debug_assert_ne!()` analogue that prints the error with line number information instead of /// panicking. @@ -110,3 +121,4 @@ macro_rules! nih_debug_assert_ne { } ); } +pub use nih_debug_assert_ne; diff --git a/src/lib.rs b/src/lib.rs index 3b5b0e8c..b272ed65 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,8 +4,10 @@ #![cfg_attr(feature = "docs", feature(doc_auto_cfg))] #![cfg_attr(feature = "simd", feature(portable_simd))] +// These macros are also in the crate root and in the prelude, but having the module itself be pub +// as well makes it easy to import _just_ the macros without using `#[macro_use] extern crate nih_plug;` #[macro_use] -mod debug; +pub mod debug; /// A re-export of the `log` crate for use in the debug macros. This should not be used directly. pub use log; diff --git a/src/prelude.rs b/src/prelude.rs index f2e82d4d..86df7ddc 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -1,13 +1,7 @@ // Re-export the macros, derive macros are already re-exported ferom their respectivem odules -pub use crate::nih_dbg; -pub use crate::nih_debug_assert; -pub use crate::nih_debug_assert_eq; -pub use crate::nih_debug_assert_failure; -pub use crate::nih_debug_assert_ne; -pub use crate::nih_export_clap; -pub use crate::nih_log; -pub use crate::nih_trace; +pub use crate::debug::*; +pub use crate::nih_export_clap; #[cfg(feature = "vst3")] pub use crate::nih_export_vst3; #[cfg(feature = "standalone")]