Skip to content

Instantly share code, notes, and snippets.

@metajack
Created April 16, 2013 05:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save metajack/5393510 to your computer and use it in GitHub Desktop.
Save metajack/5393510 to your computer and use it in GitHub Desktop.
macro_rules! handle_element(
($tag:expr, $string:expr, $ctor:ident, [ $($field:ident),* ], $type_id:expr, ) => (
if eq_slice($tag, $string) {
let _element = ~$ctor {
parent: Element::new($type_id, ($tag).to_str()),
$(
$field: None
)*
};
unsafe {
return Node::as_abstract_node(_element);
}
}
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment