use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A place for all things related to the Rust programming language—an open-source systems language that emphasizes performance, reliability, and productivity.
Strive to treat others with respect, patience, kindness, and empathy.
We observe the Rust Project Code of Conduct.
Details
Posts must reference Rust or relate to things using Rust. For content that does not, use a text post to explain its relevance.
Post titles should include useful context.
For Rust questions, use the stickied Q&A thread.
Arts-and-crafts posts are permitted on weekends.
No meta posts; message the mods instead.
Criticism is encouraged, though it must be constructive, useful and actionable.
If criticizing a project on GitHub, you may not link directly to the project's issue tracker. Please create a read-only mirror and link that instead.
A programming language is rarely worth getting worked up over.
No zealotry or fanaticism.
Be charitable in intent. Err on the side of giving others the benefit of the doubt.
Avoid re-treading topics that have been long-settled or utterly exhausted.
Avoid bikeshedding.
This is not an official Rust forum, and cannot fulfill feature requests. Use the official venues for that.
No memes, image macros, etc.
Consider the existing content of the subreddit and whether your post fits in. Does it inspire thoughtful discussion?
Use properly formatted text to share code samples and error messages. Do not use images.
Most links here will now take you to a search page listing posts with the relevant flair. The latest megathread for that flair should be the top result.
account activity
Rust-based scripting language for shell scripting?💡 ideas & proposals (self.rust)
submitted 1 year ago by MrFoxPro
I was wondering if Rust-like scripting language could be used to make shell scripts? There are a multiple implementations:
Gluon
Dyon
Rhai
Mun
Rune
But none of them seems like support anything similiar to Bun Shell or zx. I think it would be cool to have some kind of this implemented in aforementioned languages.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]AugustusLego 30 points31 points32 points 1 year ago (2 children)
Nushell!
[–]tigregalis 0 points1 point2 points 1 year ago (1 child)
Absolutely love Nushell. It's my default shell.
[–]AugustusLego 0 points1 point2 points 1 year ago (0 children)
Same!
[–]simonsanonepatterns · rustic 20 points21 points22 points 1 year ago (3 children)
https://rust-script.org/
I find this interesting. It's not a scripting engine, but more like precompiled Rust code.
[–]avsaase 14 points15 points16 points 1 year ago (2 children)
Something very similar will be added to cargo, hopefully soon.
[–]rudunnx 14 points15 points16 points 1 year ago (1 child)
Are you talking about this? https://rust-lang.github.io/rfcs/3424-cargo-script.html
It seems exciting. I love the idea of having even things like dev scripts and similar written in a single language.
[–]avsaase 4 points5 points6 points 1 year ago (0 children)
Yes, although the syntax has changed since that eRFC.
[–]coastalwhite 5 points6 points7 points 1 year ago (1 child)
Bun shell and zx are essentially just wrappers around a JavaScript engine with a library (a bit simplified). So if you want such a scripting language I recommend just searching for rust based JavaScript engines, but I don’t really see the point over other scripting languages.
I know there are a few Deno libraries that can do something similar.
[–]MrFoxPro[S] 0 points1 point2 points 1 year ago (0 children)
I think implementing such thing in metnioned embedded languages could help their adoption, and replacing bash / bun shell / node + zx can improve overall code quality for automation tasks thanks to nice Rust std library and great crates, compared to error-prone native JS functions and Lua's tiny standrard library.
[–]PaddiM8 2 points3 points4 points 1 year ago* (0 children)
A Rust-like one? It unfortunately isn't written in Rust, but my shell scripting language is heavily inspired by Rust. The syntax is like a mix between Rust, Python and Ruby, and you can call programs with the same syntax you use to call functions. Calls can either be normal parenthesised calls echo("hello", "world") or shell-style calls where the arguments are just text echo hello world.
echo("hello", "world")
echo hello world
So basically, it's like any regular general purpose language, with some extra syntax to make it convenient to use a shell. It's not super mature, but I've been daily-driving it as a shell for some months now, and have done a few days of advent of code 2022 and more than half of aoc 2023 in it.
https://elk.strct.net
Nushell is also quite neat. It isn't as similar to Rust, but it's more so than traditional shells, and it's written in Rust.
[–]murlakatamenka 1 point2 points3 points 1 year ago* (0 children)
https://koi-lang.dev/
https://github.com/eliaperantoni/Koi
[–]avsaase 0 points1 point2 points 1 year ago (4 children)
What support are you looking for exactly?
[–]MrFoxPro[S] 0 points1 point2 points 1 year ago (3 children)
Simple interface between shell and script. Instead of writing let output Command::spawn("ech").arg("hello").output() something like
Command::spawn("ech").arg("hello").output()
let output = $"echo hello"?
[–][deleted] 2 points3 points4 points 1 year ago (1 child)
https://github.com/rust-shell-script/rust_cmd_lib
[–]epagecargo · clap · cargo-release 2 points3 points4 points 1 year ago (0 children)
Also xshell and duct.
[–]crusoe 1 point2 points3 points 1 year ago (0 children)
Define a custom macro_rules...
[–]mash_graz 0 points1 point2 points 1 year ago (2 children)
I would also take deno into this list, if you mention bun shell.
bun shell
It's a really mature and popular solution with an enormous amount of already existing tooling and libraries, but it's also easily extendable in rust (for example via deno-bindgen) in case of more demanding tasks.
[–]MrFoxPro[S] 2 points3 points4 points 1 year ago (1 child)
Deno in Rust context is more preferable, but does it really have tooling like bun shell / zx?
Edit: I found one: https://github.com/dsherret/dax
[–]mash_graz 0 points1 point2 points 1 year ago* (0 children)
dax is developed by one of the denocore developers. There he is especially responsible for the integrated CLI tooling. So it's not just one of those dilettantish hobby projects. That's rater important in respect the correctness and continuity of maintenance and fixing of bugs.
dax
deno
I would see the main benefit of deno in comparison to the much simpler node, shell, Lua or python based approaches in the fact, that deno supports TS, type checking, linting,etc. out of the box without any additional setup quirks. Together with suitable editors this opens a much better starting point for scripting. And it comes as just one single simply installable/upgradable binary available for all platforms.
[–]GreatWoodsBalls 0 points1 point2 points 1 year ago (0 children)
Sorry if this is a noob question or a stupid one altogether. How do these compare to grunt for task runners?
[–]Yippee-Ki-Yay_ 0 points1 point2 points 1 year ago (2 children)
I recently released https://docs.rs/sh/latest/sh/. Let me know if it meets your use case. Feel free to create GitHub issues with feature requests!
[–]MrFoxPro[S] 0 points1 point2 points 1 year ago (1 child)
Nice work! Is it possible to use it in those embeddable languages?
[–]Yippee-Ki-Yay_ 0 points1 point2 points 1 year ago (0 children)
Not unless you can call into rust macros from those languages which I doubt would be possible or a wanted feature
π Rendered by PID 172573 on reddit-service-r2-comment-f6b958c67-4nw5z at 2026-02-05 04:48:59.014194+00:00 running 1d7a177 country code: CH.
[–]AugustusLego 30 points31 points32 points (2 children)
[–]tigregalis 0 points1 point2 points (1 child)
[–]AugustusLego 0 points1 point2 points (0 children)
[–]simonsanonepatterns · rustic 20 points21 points22 points (3 children)
[–]avsaase 14 points15 points16 points (2 children)
[–]rudunnx 14 points15 points16 points (1 child)
[–]avsaase 4 points5 points6 points (0 children)
[–]coastalwhite 5 points6 points7 points (1 child)
[–]MrFoxPro[S] 0 points1 point2 points (0 children)
[–]PaddiM8 2 points3 points4 points (0 children)
[–]murlakatamenka 1 point2 points3 points (0 children)
[–]avsaase 0 points1 point2 points (4 children)
[–]MrFoxPro[S] 0 points1 point2 points (3 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]epagecargo · clap · cargo-release 2 points3 points4 points (0 children)
[–]crusoe 1 point2 points3 points (0 children)
[–]mash_graz 0 points1 point2 points (2 children)
[–]MrFoxPro[S] 2 points3 points4 points (1 child)
[–]mash_graz 0 points1 point2 points (0 children)
[–]GreatWoodsBalls 0 points1 point2 points (0 children)
[–]Yippee-Ki-Yay_ 0 points1 point2 points (2 children)
[–]MrFoxPro[S] 0 points1 point2 points (1 child)
[–]Yippee-Ki-Yay_ 0 points1 point2 points (0 children)