struct A {
pub v: i64
}
macro_rules! pretty {
( $t:ty, $_self:ident => $body:block ) => (
impl $t {
pub fn pretty(&$_self) -> String $body
}
)
}
pretty! (A, bla => {
format!("<A:{}>", bla.v)
});
fn main() {
println!("Pretty: {}", A { v: 3 }.pretty());
}