rain-lang 0.0.1

An implementation of an RVSDG in Rust with a concept of lifetimes
Documentation
/*!
Primitive `rain` types and values
*/

pub mod logical;
pub mod binary;

use std::fmt::{self, Debug, Display, Formatter};

macro_rules! debug_from_display {
    ($d_ty:ty) => {
        impl Debug for $d_ty {
            fn fmt(&self, fmt: &mut Formatter) -> Result<(), fmt::Error> {
                <Self as Display>::fmt(self, fmt)
            }
        }
    }
}

macro_rules! unit_primitive {
    ($u_ty:ty, $name:literal) => {
        impl Display for $u_ty {
            fn fmt(&self, fmt: &mut Formatter) -> Result<(), fmt::Error> {
                write!(fmt, $name)
            }
        }
        debug_from_display!($u_ty);
    }
}

/// The unit type
#[derive(Copy, Clone, Eq, PartialEq, Hash)]
pub struct Unit;
unit_primitive!(Unit, "#unit");

/// The empty type
#[derive(Copy, Clone, Eq, PartialEq, Hash)]
pub struct Empty;
unit_primitive!(Empty, "#empty");