Skip to content
Snippets Groups Projects
macros.rs 1.05 KiB
Newer Older
  • Learn to ignore specific revisions
  • //! Assorted set of macros to be used in the context of Boytacean.
    
    
    #[cfg(feature = "debug")]
    #[macro_export]
    macro_rules! debugln {
        ($($rest:tt)*) => {
    
    João Magalhães's avatar
    João Magalhães committed
            {
                std::print!("[DEBUG] ");
                std::println!($($rest)*);
            }
    
        }
    }
    
    #[cfg(not(feature = "debug"))]
    #[macro_export]
    macro_rules! debugln {
        ($($rest:tt)*) => {
            ()
    
    #[macro_export]
    macro_rules! infoln {
        ($($rest:tt)*) => {
            {
                std::print!("[INFO] ");
                std::println!($($rest)*);
            }
        }
    }
    
    
    #[cfg(feature = "pedantic")]
    #[macro_export]
    macro_rules! warnln {
        ($($rest:tt)*) => {
            {
    
                if unsafe { $crate::diag::PEDANTIC } {
                    $crate::panic_gb!($($rest)*);
                } else {
                    std::print!("[WARNING] ");
                    std::println!($($rest)*);
                }
    
            }
        }
    }
    
    #[cfg(not(feature = "pedantic"))]
    
    #[macro_export]
    macro_rules! warnln {
        ($($rest:tt)*) => {
            {
                std::print!("[WARNING] ");
                std::println!($($rest)*);
            }
        }
    }