Files @ a12023821ace
Branch filter:

Location: CSY/reowolf/src/macros.rs - annotation

a12023821ace 795 B application/rls-services+xml Show Source Show as Raw Download as Raw
Max Henger
Merge branch 'feat-compiler-bin' into 'master'

feat: compiler binary

See merge request nl-cwi-csy/reowolf!2
// Utility for performing debug printing within a particular module. Still
// requires some extra macros to be defined to be ergonomic.
macro_rules! enabled_debug_print {
    (false, $name:literal, $format:literal) => {};
    (false, $name:literal, $format:literal, $($args:expr),*) => {};
    (true, $name:literal, $format:literal) => {
        println!("[{}] {}", $name, $format)
    };
    (true, $name:literal, $format:literal, $($args:expr),*) => {
        println!("[{}] {}", $name, format!($format, $($args),*))
    };
}

// Utility for inserting code only executed in debug mode. Because writing the
// conditional cfg is tedious and looks ugly. Still doesn't work for struct
// fields, though.
macro_rules! dbg_code {
    ($code:stmt) => {
        #[cfg(debug_assertions)] $code
    }
}