prettyplease
prettyplease | topiary | |
---|---|---|
8 | 3 | |
588 | 486 | |
- | 2.9% | |
7.7 | 8.8 | |
21 days ago | 5 days ago | |
Rust | Rust | |
Apache License 2.0 | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
prettyplease
-
Practical Procedural Macros in Rust
Nice blog, another very useful crate to use when working with proc-macro is https://github.com/dtolnay/prettyplease, for formatting generated code (very useful for debugging!), that does not bails out like rustfmt sometimes does.
-
Minimalist Rust formatter as an alternative to rustfmt?
I doubt you would want to actually use this human-consumed code, but an interesting alternative that I know of is David Tolnay's prettyplease. It tries to be lightweight and consistent for auto-generated code.
-
Gene Michaels: Alternative Rust code formatter
btw there is also https://github.com/dtolnay/prettyplease
-
Anyone have lot's of problems with rustfmt?
This, I also have a bunch of files that seem to break rustfmt. Ime, it doesn't exactly refuse to format the whole file but it's picky in what and to what degree it chooses to format, basically anything flying in the complex blocks. I have run into prettyplease but I'm yet to actually try it on these offenders.
-
Hey Rustaceans! Got an easy question? Ask here (5/2022)!
prettyplease
-
Is generating code from JSON a good macro use case?
Optionally, format the generated code to make it more readable. You can run rustfmt on the output file, or use prettyplease before writing the file.
- Prettyp lease: A minimal Syn syntax tree pretty- printer
- prettyplease: A minimal Syn syntax tree pretty-printer
topiary
-
Show HN: GritQL, a Rust CLI for rewriting source code
You should check out https://github.com/tweag/topiary
Yes, theoretically if you had ~identical grammars you could use it to do a full transpilation. There's a lot of challenges with that though. Writing a correct grammar for 1 language is complicated enough, but writing one for two where all your nodes and fields end up the same is likely insurmountable.
In practice, languages are either:
- Far enough apart that any pure AST transformation is insufficient and you need an AI component to produce usable output
-
Elastic Tab Stops (2017)
This is something we've discussed[1] in the development of Topiary, deferring the process to the formatter. It's not a priority issue for us right now, but given the lack of universal editor support for elastic tab stops, having the formatter do this seems like a reasonable solution.
[1]: https://github.com/tweag/topiary/issues/170
-
Minimalist Rust formatter as an alternative to rustfmt?
build on top of https://github.com/tweag/topiary/blob/main/languages/rust.scm
What are some alternatives?
prettier-plugin-rust - Prettier Rust is an opinionated code formatter that autocorrects bad syntax.
quote - Rust quasi-quoting
goformat - Alternative to gofmt with configurable formatting style (indentation etc.)
tokio-tungstenite - Future-based Tungstenite for Tokio. Lightweight stream-based WebSocket implementation
genemichaels - Even formats macros
rosetta - Easy to use Rust i18n library based on code generation
rfcs - RFCs for changes to Rust