DEV Community

Discussion on: Rust #7: Command-Line interfaces

Collapse
 
ksnyde profile image
Ken Snyder

Great stuff Matt. I've been wanting to dip into Rust and have thought a CLI might be a good way to put a toe in. This post makes the process seem much more approachable. Thanks for taking the time to put pen to paper.

Collapse
 
ksnyde profile image
Ken Snyder

BTW, completely random question but wondering if you've had the chance to use Rust to transpile Markdown to HTML? I remember seeing a crate a while back that looked to have amazing performance characteristics and with a lot of SPA's, blogging frameworks, etc. having this capability but almost all using Javascript to do it ... I was just wondering what kind of performance benefit Rust might bring.

Collapse
 
ksnyde profile image
Ken Snyder

Final post in my "random post series" ... in terms of immediately useable use-cases for Rust I think the CLI is a real winner but the other one is Rust's ability to produce WebAssembly. I was looking around at crypto code for a project and I'm starting to think that a Rust-to-WA version of AES's GCM might be higher performance (almost surely) and possibly smaller payload (my visibility is limited). The example I saw did not implement GCM though (and it's the only one in web crypto that support verification) and so I'm feeling a bit intimidated at hitting crypto for my first foray into Rust. :)

Thread Thread
 
cthutu profile image
Matt Davies

I don't have much experience with WASM and Rust or with Crypto crates. WASM is definitely something I want to explore and write a blog article about.

Collapse
 
cthutu profile image
Matt Davies

No, I haven't mainly because it's already been done. You may want to check out the mdbook project. cargo install mdbook will install it for you. Rust has the same performance as C roughly so compared to JS, much much faster.

Thread Thread
 
ksnyde profile image
Ken Snyder

I just want to see if the parsers that are out there offer a decent plugin eco-system as I could see this being really useful for pre-rending a big content site's build process but I'd definitely need to hook into the conversion process and it would be be great if some plugins already existed so I didn't have to write it all myself. Anyway, once i get to my main computer I'll have a look at mdbook and see how I fair. Thanks for the pointer.

Thread Thread
 
ksnyde profile image
Ken Snyder

Wow, looks like it's all there. Very neat. Hope I don't get too deep into a rabbit hole. :)

Thread Thread
 
cthutu profile image
Matt Davies

That's part of the fun.

Collapse
 
cthutu profile image
Matt Davies

Here's an idea for a CLI to get a taste for Rust. Try implementing a hex dump program. You need CLI arguments for the filename. Perhaps you can add a --colour option for outputting the offsets, hex codes and ASCII output in different colours. It might be fun.