Skip to content

Instantly share code, notes, and snippets.

@eddyb
Forked from Manishearth/gist:4db6b5873dd0f4eef437
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eddyb/63b3435a55af96522b9c to your computer and use it in GitHub Desktop.
Save eddyb/63b3435a55af96522b9c to your computer and use it in GitHub Desktop.
pub trait Show {
#[derive_scheme(
TupleLike { try!(fmt.write_str(concat!($_name, "("))); try!($_); fmt.write(b")") }
StructLike { try!(fmt.write_str(concat!($_name, "{"))); try!($_); fmt.write(b"}") }
UnitLike { fmt.write_str($_name) }
AnonymousList { try!($_);try!(fmt.write_str(",")) }
NamedList { try!(fmt.write_str(concat!($_name, ":")));try!($_);try!(fmt.write_str(",")) }
)]
fn fmt(&self, fmt: &mut Formatter) -> Result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment