Re-export debug macros from the debug module
This makes it easy to import just the macros without having to use the oldschool `#[macro_use] extern crate ...;` syntax.
This commit is contained in:
parent
3d454bfc9c
commit
98876670f8
|
@ -14,6 +14,7 @@
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use nih_plug::debug::*;
|
||||||
use std::f32::consts;
|
use std::f32::consts;
|
||||||
use std::ops::{Add, Mul, Sub};
|
use std::ops::{Add, Mul, Sub};
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,6 @@
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
extern crate nih_plug;
|
|
||||||
|
|
||||||
use nih_plug::prelude::*;
|
use nih_plug::prelude::*;
|
||||||
use nih_plug_vizia::ViziaState;
|
use nih_plug_vizia::ViziaState;
|
||||||
use pcg::Pcg32iState;
|
use pcg::Pcg32iState;
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use nih_plug::debug::nih_debug_assert;
|
||||||
use std::f32::consts;
|
use std::f32::consts;
|
||||||
use std::ops::{Add, Mul, Sub};
|
use std::ops::{Add, Mul, Sub};
|
||||||
use std::simd::f32x2;
|
use std::simd::f32x2;
|
||||||
|
|
|
@ -19,9 +19,6 @@
|
||||||
#[cfg(not(feature = "simd"))]
|
#[cfg(not(feature = "simd"))]
|
||||||
compile_error!("Compiling without SIMD support is currently not supported");
|
compile_error!("Compiling without SIMD support is currently not supported");
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
extern crate nih_plug;
|
|
||||||
|
|
||||||
use nih_plug::prelude::*;
|
use nih_plug::prelude::*;
|
||||||
use nih_plug_vizia::ViziaState;
|
use nih_plug_vizia::ViziaState;
|
||||||
use std::simd::f32x2;
|
use std::simd::f32x2;
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
use nih_plug::debug::*;
|
||||||
use std::f32::consts;
|
use std::f32::consts;
|
||||||
use std::ops::{Add, Mul, Sub};
|
use std::ops::{Add, Mul, Sub};
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,6 @@
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
extern crate nih_plug;
|
|
||||||
|
|
||||||
use nih_plug::prelude::*;
|
use nih_plug::prelude::*;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
|
12
src/debug.rs
12
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
|
/// 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.
|
/// debugger has been attached, in which case `OutputDebugString()` will be used instead.
|
||||||
///
|
///
|
||||||
|
@ -14,6 +19,7 @@ macro_rules! nih_log {
|
||||||
$crate::log::info!($($args)*)
|
$crate::log::info!($($args)*)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
pub use nih_log;
|
||||||
|
|
||||||
/// The same as `nih_log!()`, but with source and thread information. Like the
|
/// 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.
|
/// `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)*))
|
$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
|
/// 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*!()`
|
/// 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)),+,) };
|
($($val:expr),+ $(,)?) => { ($($crate::nih_dbg!($val)),+,) };
|
||||||
}
|
}
|
||||||
|
pub use nih_dbg;
|
||||||
|
|
||||||
/// A `debug_assert!()` analogue that prints the error with line number information instead of
|
/// A `debug_assert!()` analogue that prints the error with line number information instead of
|
||||||
/// panicking.
|
/// 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
|
/// An unconditional debug assertion failure, for if the condition has already been checked
|
||||||
/// elsewhere.
|
/// 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
|
/// A `debug_assert_eq!()` analogue that prints the error with line number information instead of
|
||||||
/// panicking.
|
/// 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
|
/// A `debug_assert_ne!()` analogue that prints the error with line number information instead of
|
||||||
/// panicking.
|
/// panicking.
|
||||||
|
@ -110,3 +121,4 @@ macro_rules! nih_debug_assert_ne {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
pub use nih_debug_assert_ne;
|
||||||
|
|
|
@ -4,8 +4,10 @@
|
||||||
#![cfg_attr(feature = "docs", feature(doc_auto_cfg))]
|
#![cfg_attr(feature = "docs", feature(doc_auto_cfg))]
|
||||||
#![cfg_attr(feature = "simd", feature(portable_simd))]
|
#![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]
|
#[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.
|
/// A re-export of the `log` crate for use in the debug macros. This should not be used directly.
|
||||||
pub use log;
|
pub use log;
|
||||||
|
|
|
@ -1,13 +1,7 @@
|
||||||
// Re-export the macros, derive macros are already re-exported ferom their respectivem odules
|
// Re-export the macros, derive macros are already re-exported ferom their respectivem odules
|
||||||
pub use crate::nih_dbg;
|
pub use crate::debug::*;
|
||||||
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::nih_export_clap;
|
||||||
#[cfg(feature = "vst3")]
|
#[cfg(feature = "vst3")]
|
||||||
pub use crate::nih_export_vst3;
|
pub use crate::nih_export_vst3;
|
||||||
#[cfg(feature = "standalone")]
|
#[cfg(feature = "standalone")]
|
||||||
|
|
Loading…
Reference in a new issue