use core::fmt::{
self,
Binary,
Debug,
Display,
LowerExp,
LowerHex,
Octal,
Pointer,
UpperExp,
UpperHex,
Formatter,
};
pub struct Pretty<T>(T);
impl<T: Display> Debug for Pretty<T> {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
Display::fmt(&self.0, f)
}
}
impl<T: Binary> Binary for Pretty<T> {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
Binary::fmt(&self.0, f)
}
}
impl<T: Display> Display for Pretty<T> {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
Display::fmt(&self.0, f)
}
}
impl<T: LowerExp> LowerExp for Pretty<T> {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
LowerExp::fmt(&self.0, f)
}
}
impl<T: LowerHex> LowerHex for Pretty<T> {
#[inline(always)]
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
LowerHex::fmt(&self.0, f)
}
}
impl<T: Octal> Octal for Pretty<T> {
#[inline(always)]
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
Octal::fmt(&self.0, f)
}
}
impl<T: Pointer> Pointer for Pretty<T> {
#[inline(always)]
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
Pointer::fmt(&self.0, f)
}
}
impl<T: UpperExp> UpperExp for Pretty<T> {
#[inline(always)]
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
UpperExp::fmt(&self.0, f)
}
}
impl<T: UpperHex> UpperHex for Pretty<T> {
#[inline(always)]
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
UpperHex::fmt(&self.0, f)
}
}
impl<T: Sized> From<T> for Pretty<T> {
fn from(val: T) -> Self {
Self(val)
}
}
pub trait Prettify: Sized {
fn prettify(self) -> Pretty<Self> {
self.into()
}
}