syn-rsx

crates.io page docs.rs page build license: MIT

syn-powered parser for JSX-like TokenStreams. The parsed result is a nested Node structure, similar to the browser DOM.

```rust use quote::quote; use syn_rsx::parse2;

let tokens = quote! {

"hello"
};

let nodes = parse2(tokens, None).unwrap();

let node = &nodes[0]; asserteq!(node.attributes[0].nameas_string().unwrap(), "foo");

let children = &node.children; asserteq!(children.len(), 2); asserteq!(children[0].children[0].valueasstring().unwrap(), "hello"); asserteq!(children[1].nameas_string().unwrap(), "world"); ```