๐Ÿ’พ Archived View for bbs.geminispace.org โ€บ s โ€บ rust_software โ€บ 14044 captured on 2024-07-09 at 07:13:13. Gemini links have been rewritten to link to archived content

View Raw

More Information

โฌ…๏ธ Previous capture (2024-07-09)

โžก๏ธ Next capture (2024-08-18)

-=-=-=-=-=-=-

Software written in Rust: ripgrep

I made a space to discuss Rust software projects. Why Rust specifically? Well, first of all because it's a meme, and second of all because well-written Rust provides some security and performance benefits that lead me to prefer many Rust tools over others.

A third reason that may resonate with some Gemini users is that many Rust tools seem to be designed with simplicity in mind. Perhaps this is due to how new many of these tools are, so they haven't had time to acquire feature creep, or perhaps it is due to the added difficulty of building extremely complex tools in Rust. Macros will only get you so far!

Anyway, I hope this ends up being an interesting space for everyone.

---

The first software I'll mention is ripgrep, which has become essential to me. It's grep, but faster, and with the (optional) ability to search within complex documents like PDFs using preprocessors. Plus "rg" is quicker to type than "grep."

I like how you can just "rg foo" to search the current directory (and subdirectories) for files containing "foo." Sure you could rig up a bash function to do it but it's nice to have that out of the box.

https://github.com/BurntSushi/ripgrep

If you have some favorite tools written in Rust, please consider sharing them here.

Posted in: s/rust_software

๐Ÿค– gamma [mod]

Jan 18 ยท 6 months ago

5 Comments โ†“

๐Ÿ–ฅ๏ธ zetamacs ยท Jan 18 at 14:18:

@gamma And don't forget that ripgrep is wicked fast.

I've been impressed with Nushell and use of Rust in the embedded space.

I'll also say that, with both Go and Rust intending (partly) to serve as alternatives to C++, I find Rust the more attractive in that domain. Where Go hesitates to provide some possible language features because of how readily they can be abused/misused in the wrong hands, Rust doesn't shy away from giving you everything, but with warning stickers where they need to be.

That's not to say that Go is bad; it's a core philosophical difference that leads to different development experiences.

๐Ÿค– gamma [OP/mod] ยท Jan 18 at 15:52:

I agree and will add that Go probably makes more sense for infrastructure code at some $bigco where you have frequent changes and fluctuating staff. It's definitely easier to read! But I really like Rust for slow-moving code, which means it's ideal for both utility apps and clients for static protocols like Gemini.

๐Ÿฆ€ jeang3nie ยท Jan 19 at 20:09:

I started learning Rust in about 2018, about the same time I started really buckling down to learn C. I really loved it for a while, followed by a period where I started having doubts about it (mostly related to the repeated bungling of the project's leadership). I'm back to working on some of my Rust projects again now, and I have to say it feels comfy and homey for me.

I think it's a good idea for anyone using a higher level language to drill down and really learn how to use C in anger. It's the only way a lot of devs will learn how a lot of common data structures work under the hood, because they'll have to write them from scratch. But going back to Rust after a short while of abandoning it for C my experience has been that I'm dramatically more productive in Rust. When writing C I'll constantly reinvent the wheel and write my own hashmaps and linked lists, tweaking them very specifically for the actual use case, wringing every last drop of performance out that I can. With Rust I'll just use what the std library has to offer and write three times as much code in an hour. What's funny is that it winds up being just as fast most of the time.

Rust is definitely not perfect. The binary sizes are big, you get a lot of dead code compiled into your binaries and the crates ecosystem is kind of a mess because they didn't plan ahead for the explosive growth that the language has experienced. But it excels when it comes to code correctness and makes things that are hard in other languages trivially simple. I write a lot of code that executes in parallel, and you can drill down right to the hardware and register level just the same as in C if you want. As compromises go I think it's made mostly good ones.

As for cool software written in Rust I'll mention the Helix editor. I tried it out a few months ago and surprisingly just never stopped using it. Helix does everything I had painstakingly set up NeoVim to do, but it does it without having to rice your configuration four hours a day until you finally get something you like.

๐Ÿค– gamma [OP/mod] ยท Jan 20 at 04:33:

Thanks for the response, I agree completely and I also like Helix quite a lot! I'm hoping to make a longer post about it in the future.

๐Ÿ mifuyne ยท Jan 20 at 21:37:

I really wanted Helix to be enough for my use case, but the difference in command grammar trips me up. To be fair, I only use it to write my posts and pages for my capsule. Neovim + goyo.vim have done well for me on that front. That said, I still have Helix installed so I can use it here and there, learn it little by little ๐Ÿ™‚

On another note, I've found a curated list of projects made in Rust here:

โ€” https://github.com/rust-unofficial/awesome-rust

I don't know how many of you have already seen it though...

I think out of all of those, nu(shell) is the one I'd like to shout out here. I like their approach, where the output is structured data, rather than plain text. So you could do something like this:

> ls | sort-by size | reverse
โ•ญโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ #  โ”‚         name          โ”‚ type โ”‚   size    โ”‚  modified   โ”‚
โ”œโ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  0 โ”‚ Gemfile.lock          โ”‚ file โ”‚   6.9 KiB โ”‚ 3 days ago  โ”‚
โ”‚  1 โ”‚ SUMMARY.md            โ”‚ file โ”‚   3.7 KiB โ”‚ 3 days ago  โ”‚
โ”‚  2 โ”‚ Gemfile               โ”‚ file โ”‚   1.1 KiB โ”‚ 3 days ago  โ”‚
โ”‚  3 โ”‚ LICENSE               โ”‚ file โ”‚   1.1 KiB โ”‚ 3 days ago  โ”‚
โ”‚  4 โ”‚ CONTRIBUTING.md       โ”‚ file โ”‚     955 B โ”‚ 9 mins ago  โ”‚
โ”‚  5 โ”‚ books.md              โ”‚ file โ”‚     687 B โ”‚ 3 days ago  โ”‚

โ€” https://www.nushell.sh/book/quick_tour.html

I know that this can be done with ls by adding the -laS flag, but the strength is from being able to use those filters on other commands too.

There's definitely a learning curve and not ready to replace traditional shells. All existing shell scripts will need to be rewritten to be used in nushell. I only use it in a specific terminal profile (although it's also my default profile), just in case I do need to run a bash script.

IMO, worth a look if you have the time and resources to spare!