antifacet 0.1.0

crate for general utilities
Documentation
#![cfg_attr(false, no_std)]

use crate::cmp::{
	EqReport,
	Mismatch,
};

extern crate alloc;

pub mod cmp;
pub mod color;
pub mod format;

pub trait Aktion {
	#[inline(always)]
	fn boxed(&self) -> &self::Box<Self> {
		unsafe { &*(self as *const Self as *const self::Box<Self>) }
	}

	#[inline(always)]
	fn by_ref(&self) -> &Self {
		self
	}

	#[inline(always)]
	fn by_mut(&mut self) -> &mut Self {
		self
	}

	#[inline(always)]
	fn cmp_eq<Cmp: EqReport<Self>>(
		&self,
		rhs: &Self,
		cmp: &Cmp,
	) -> Result<(), Mismatch<Cmp::Report>> {
		cmp.eq_report(self, rhs)
	}
}

impl<T: ?Sized> Aktion for T {}

mod facet_pretty;

#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[repr(transparent)]
pub struct Box<Cmp: ?Sized>(pub Cmp);

#[doc(hidden)]
pub mod panic;

#[macro_export]
macro_rules! assert_eq {
	($lhs:expr, $rhs:expr, $cmp:expr $(,)?) => {
		match (&$lhs, &$rhs, &$cmp) {
			(lhs, rhs, cmp) => $crate::panic::assert_eq(lhs, rhs, cmp),
		}
	};
}