rustmon fileName.rs
or rmon fileName.rs
For e.g., let say you have a rust program myprogram.rs
then you'd need to run rustmon myprogram
from the cli to run it in monitor mode.
Global rustfmt.toml file location => PR: rust-lang/rustfmt#3280 .
An ideal Cargo.toml file should be place in the root of folder opened in vscode i.e.,
(Bcoz Vscode's rust extension using command cargo fmt --all
to format the code and throws error if the Cargo.toml file isn't formatted properly.)
[package]
name = "a-small-rust-app"
version = "0.1.0"
[[bin]]
name = "general"
path = "01_println.rs"
Simply install this extension and make sure that you have a cargo.toml file in the root of folder that you have opened in vscode to make format on save works!
rustup update
- Tutorial here.
0.5. Was here.
-
Whenever you see something like
car::bike::scooter
means thatcar
is a module andbike
is nested module insidecar
andscooter
is a module nested insidebike
. -
strings: amazing article, or read from amazing docs :LOL:.
-
Reqwest
-
Rustler thing(popular idk why..): 1. @docs, 2. @github, @crates.io site.
**Continue the vid-35 tutorial/and making this gist. @ here
Follow a different course, and it feel good too
-
https://rust-lang-nursery.github.io/rust-cookbook/web/clients.html
-
https://crates.io/ - The Rust community’s crate registry
-
https://www.rust-lang.org/learn - Book, Course and Example.(Seems good) And other references to learn quickly.
-
https://www.rust-lang.org/learn/get-started - A small rust app(demonstration, yikes).
-
Variable Shadoing: When we declare a binding in nested scope which is already declared in its parent scope. @ wikipedia
Creating rust projects with cargo (source)
$ cargo new hello-world-cargo --bin # --bin tells the cargo to create a application project, not a library project.
$ cd hello-world-cargo
$ cargo run # This will output `Hello world!`. Congrats!!
$ `cargorun` or `cw` will run cargo in dev mode just like nodemon does, yikes!
The cargo application has entry point from src/main.rs
file. All rust programs begin with a main
function.
Firstly, anytime you make changes to src/main.rs
, you need to run cargo run
from cli. Secondly, cargo.toml
file is similar to package.json file, as you'll find project info
and dependencies there. Thirdly, you'll get a git initiated project with pre-made .gitignore
file.
// File, main.rs
fn main(){
println!("Hello world!")
}
Compile rust program via rustc main.rs
and run it via ./main
(from bash) or main.exe
(from command prompt).
--bin
Create a package with a binary target (src/main.rs). This is the default behavior.
--lib
Create a package with a library target (src/lib.rs).
src: https://github.com/rust-lang/vscode-rust#snippets
## Snippets
Snippets are code templates which expand into common boilerplate. IntelliSense includes snippet names as options when you type; select one by pressing enter. You can move to the next snippet 'hole' in the template by pressing tab. We provide the following snippets:
for - a for loop
macro_rules - declare a macro
if let - an if let statement for executing code only when a pattern matches
spawn - spawn a thread
extern crate - insert an extern crate statement
This extension is deliberately conservative about snippets and doesn't include too many. If you want more, check out Trusty Rusty Snippets.
So, fun.. below extension provides many rust snippets and officially recommended from rust vscode extension for snippets.
https://marketplace.visualstudio.com/items?itemName=polypus74.trusty-rusty-snippets