1

I'm playing around with writing Rust snippets in my editor. I can get org mode to format my things nicely and play nicely with rust-mode. But I can't evaluate my code snippets. I think that may be because Rust isn't strictly a scripting language, as the suggestive error, "error: no such subcommand: script" provides, when I try to expand my rust source blocks. I could be just misunderstanding though.

Edit: I figured out how to solve my problem but minutes later, see answer below. I've moved onto a new question though: how I might run a linter or flycheck in org-mode.

4

Hot diggity darn, but minutes later I discovered a crate for that. For future people landing on this question, all I had to do was run

cargo install cargo-script

and bam you'll be off and org-babel-ing. If you've got Cargo.el installed in your profile, you can evaluate pretty quick using Cargo-run. This may become how I write Rust going forward, if I can get flycheck to work too.

2
  • TELL ME YOUR SECRETS WISE ONE – 0atman Oct 26 '20 at 16:55
  • So rust works in babel out of the box for me (doom emacs), but I want what you have - cargo script to run the rust in the code blocks! – 0atman Oct 26 '20 at 16:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.