NewBee Question: Rust IDE choices

Hi, I'm a beginner in rust and it's a cool language!

Also thanks a lot from the ppl here, you guys are really warm hearted.

I was using VScode as IDE before, but for a beginner, jupyter-notebook or lab may be more friendly to us. I tried to use jupyter-notebook today, but when querying APIs, I met 2 issues:

  • A) compiling a lot pkgs as default:
    in my cell, I only used
:dep plotters = { version = "^0.3.0", default_features = false, features = ["evcxr", "all_series"] }
:dep tokio = { version = "1", features = ["full"] }
:dep reqwest = { version = "0.11", features = ["blocking", "json"]}
:dep dotenv = "0.15"
:dep serde_json = "1.0"
:dep thiserror = "1.0.26"
:dep anyhow = "1.0"

but seems the kernel complied others also... and it was super slow..

  • B) got stuck.... I'm querying my APIs, but it worked the first time running the code. When I'd like to query again for debugging, it just got stuck here....
let mut client = DataAPIClient::new("https://api.example.com", "https://api2.example.com")

if I want to run it again, I need to stop the cell at first and it raised this err:
Subprocess terminated with signal 9. This is known to happen when evcxr is installed via a Homebrew shell under emulation. Try installing rustup and evcxr without using Homebrew and see if that helps.
Then I run the cell again and it was good.... really annoying....

May I ask what is the best practice of using it or is there anyother IDE's may be good for a beginner?

Those packages have dependencies, too.

1 Like

emm, make sense. Thanks again for gimme a reply!

it was much faster directly using cargo build..... I do not know how the jupyter kernel works, but it really takes a lot time...

I really don't see how Rust can make for a smooth experience in such a notebook. By virtue of it being a compiled language, it just is not designed to have that interactive use as interpreted languages like Python or Javascript.

I would have thought VS Code with the Rust analyser plugin is very helpful for beginners to Rust. What with it's highlighting of syntax errors and other useful features.

1 Like

evcxr is using clever tricks to do something Rust wasn't meant to do. Go ahead and use it if you want, but you should expect it to not work for all use cases, and not to be the best beginner experience.

1 Like

The best beginner experience comes from honestly trying to learn the language and the tooling as-is. Trying to bend the language to behave as if it were Python or JavaScript or $LANG is an advanced topic, and will cause nothing but pain if you don't know what you are doing.

4 Likes

thanks all you guys for the help! I'll quit using notebook but VScode then.

I am very new to Rust and have essentially only worked with languages with repl such as Python, Julia and Javascript. And, I have downloaded evcxr and sometimes try functions/methods in it before using them in my code. However, I want to do what you are saying here: "The best beginner experience comes from honestly trying to learn the language and the tooling as-is."

What is the correct way to try functions/methods in Rust that I don't understand well, if not in a REPL? Would you suggest writing a small test function in my code that uses that method or function and running the tests to see if it works as expected? For example, if I want to know how, say filter works. Should I write a test function that uses filter on some basic example and run a test with it?

Thank you.

I usually use the Playground for that kind of experimentation.

Okay. Thank you.

You can also create a local Rust project that you use for experimentation; drop something in main.rs or a #[test] and run that. This is basically what the Playground does for you, but you get your own choice of libraries, no 10-second timeout, and it will often be faster since it's not running on a shared system with lots of other people using it.

  • enable autosave
  • cargo watch -x check -x test
  • write some #[test]s
2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.