summaryrefslogtreecommitdiffstats
path: root/vendor/regex-automata-0.2.0/src/macros.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/regex-automata-0.2.0/src/macros.rs')
-rw-r--r--vendor/regex-automata-0.2.0/src/macros.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/vendor/regex-automata-0.2.0/src/macros.rs b/vendor/regex-automata-0.2.0/src/macros.rs
new file mode 100644
index 000000000..649ba17c5
--- /dev/null
+++ b/vendor/regex-automata-0.2.0/src/macros.rs
@@ -0,0 +1,30 @@
+/// A simple macro for defining bitfield accessors/mutators.
+#[cfg(feature = "alloc")]
+macro_rules! define_bool {
+ ($bit:expr, $is_fn_name:ident, $set_fn_name:ident) => {
+ fn $is_fn_name(&self) -> bool {
+ self.bools & (0b1 << $bit) > 0
+ }
+
+ fn $set_fn_name(&mut self, yes: bool) {
+ if yes {
+ self.bools |= 1 << $bit;
+ } else {
+ self.bools &= !(1 << $bit);
+ }
+ }
+ };
+}
+
+macro_rules! log {
+ ($($tt:tt)*) => {
+ #[cfg(feature = "logging")]
+ {
+ $($tt)*
+ }
+ }
+}
+
+macro_rules! trace {
+ ($($tt:tt)*) => { log!(log::trace!($($tt)*)) }
+}