blr-lang 0.1.0

A language implementation that provides type safe dataframes
Documentation
pub struct DebugAltValue<T> {
    value: T,
}

impl<T> From<T> for DebugAltValue<T> {
    fn from(value: T) -> Self {
        Self { value }
    }
}

impl<T: std::fmt::Debug> std::fmt::Debug for DebugAltValue<T> {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{:#?}", self.value)
    }
}

#[macro_export]
macro_rules! info_alt {
    ($($expr:ident),* $(,)?, $msg:literal) => {
        tracing::info!($($expr = ?$crate::debug::DebugAltValue::from(&$expr)),*, $msg)
    };
    ($($key:ident = $value:expr),* $(,)?, $msg:literal) => {
        tracing::info!($($key = ?$crate::debug::DebugAltValue::from(&$value)),*, $msg)
    };
}
#[macro_export]
macro_rules! debug_alt {
    ($($expr:ident),* $(,)?, $msg:literal) => {
        tracing::debug!($($expr = ?$crate::debug::DebugAltValue::from(&$expr)),*, $msg)
    };
    ($($key:ident = $value:expr),* $(,)?, $msg:literal) => {
        tracing::debug!($($key = ?$crate::debug::DebugAltValue::from(&$value)),*, $msg)
    };
}
#[macro_export]
macro_rules! trace_alt {
    ($($expr:ident),* $(,)?, $msg:literal) => {
        tracing::trace!($($expr = ?$crate::debug::DebugAltValue::from(&$expr)),*, $msg)
    };
    ($($key:ident = $value:expr),* $(,)?, $msg:literal) => {
        tracing::trace!($($key = ?$crate::debug::DebugAltValue::from(&$value)),*, $msg)
    };
}

pub struct RawString<'a>(pub &'a String);

impl<'a> std::fmt::Debug for RawString<'a> {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}