Hacker News new | ask | show | jobs
by gitgud 2122 days ago
Interesting, it seems that it allows the exact syntax of shell commands, without using strings.

    // valid rust code and shell code, no strings
    run_cmd!(du -ah . | sort -hr | head -n 10)?;
How does rust parse the statement within run_cmd()? Can rust parse other languages like this?

    run_html!(<div>COOL</div>)
3 comments

Yes! If you are interested in doing front-end in Rust using Wasm, checkout Yew : https://github.com/yewstack/yew The data flow is inspired by React, you’ll feel right at home.
Yeah, there's a system for macro definition where you define the language the macro accepts. It's very powerful and can probably do most of what you're imagining in this comment.