debug_display 0.2.0

Small crate to allow using Debug as regular Display (Why isn't this just part of std?)
Documentation
use proc_macro::TokenStream;

#[proc_macro_derive(Display)]
pub fn display_derive(input: TokenStream) -> TokenStream {
    let mut input_iter = input.into_iter().peekable();
    for i in input_iter.by_ref() {
        match i.to_string().as_str() {
            "struct" | "enum" | "union" => break,
            _ => (),
        }
    }
    let mut name = String::new();
    let mut lifetime = String::new();
    let mut no_lifetime = true;
    loop {
        let n = input_iter.next().unwrap().to_string();
        if n.contains("{") {
            break;
        }
        name.push_str(&n);
        if !no_lifetime {
            lifetime.push_str(&n);
        } else {
            no_lifetime = false;
        }
    }
    let code = format!(
        "
        impl{} std::fmt::Display for {} {{
            fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {{
                write!(f, \"{{:?}}\", self)
            }}
        }}
        ",
        lifetime, name
    );
    code.parse().unwrap()
}