extern crate syn_impersonated as syn; extern crate quote_impersonated as quote; extern crate proc_macro2_impersonated as proc_macro2; mod gen; use proc_macro2::{Ident, Literal, TokenStream}; use ref_cast::RefCast; use std::fmt::{self, Debug}; use std::ops::Deref; use syn::punctuated::Punctuated; #[derive(RefCast)] pub struct Lite { value: T, } #[allow(non_snake_case)] pub fn Lite(value: &T) -> &Lite { Lite::ref_cast(value) } impl Deref for Lite { type Target = T; fn deref(&self) -> &Self::Target { &self.value } } impl Debug for Lite { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { write!(formatter, "{}", self.value) } } impl Debug for Lite { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { write!(formatter, "{}", self.value) } } impl Debug for Lite { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { write!(formatter, "{}", self.value) } } impl Debug for Lite { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { write!(formatter, "{:?}", self.value) } } impl Debug for Lite { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { write!(formatter, "{:?}", self.value.to_string()) } } impl Debug for Lite { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { write!(formatter, "{}", self.value) } } impl Debug for Lite { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { write!(formatter, "`{}`", self.value) } } impl<'a, T> Debug for Lite<&'a T> where Lite: Debug, { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { Debug::fmt(Lite(&*self.value), formatter) } } impl Debug for Lite> where Lite: Debug, { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { Debug::fmt(Lite(&*self.value), formatter) } } impl Debug for Lite> where Lite: Debug, { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { formatter .debug_list() .entries(self.value.iter().map(Lite)) .finish() } } impl Debug for Lite> where Lite: Debug, { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { formatter .debug_list() .entries(self.value.iter().map(Lite)) .finish() } }