Build a website with Rust [1], beginning

Build a website with Rust [1], beginning

Oct 1, 2022·

2 min read

At first, learning a language must start with the basic syntax. In the development environment, I choose visual studio code. Basic installation, if you have any questions, I believe that you can find the answer on the Internet. If you can’t find it, you can leave a message. I like to help.

Rust-lang

The second chapter starts with the basic Rust, which is similar to the C language.

cargo new project name

cargo run

let mut guess = String::new();

I think these are the three most important lines.

Rust is using Cargo as a system and package management tool.
The first line is to create the project.
The second line is to run the project.
The third line is the way to create variables, mut represents a variable, if remove the mut, it represents immutable (immutable)
Among them, :: is another question to us to ask what does this mean,
In the document, :: with the following called the associated function.
Currently, I understand it as a function within the String type.

fn main() {

println!("Hello, world!");

}

and the main() is the main body of the project, which is always executed first.

just like code in a document, just to prove I really type it lol

next part, is a little complicated to me, I got to study it, and I will talk about it in the next article.