1
00:00:00,390 --> 00:00:06,810
In this lecture, we are going to install rust on our machines before we do, let's talk about rust.

2
00:00:07,050 --> 00:00:11,760
As I mentioned before, it's one of the most loved languages by developers.

3
00:00:12,030 --> 00:00:12,840
Why is that?

4
00:00:12,960 --> 00:00:14,430
What makes it so unique?

5
00:00:15,180 --> 00:00:18,060
Designing a programming language is a tough job.

6
00:00:18,420 --> 00:00:22,740
Communities will not hesitate to point out the pain points of a language.

7
00:00:23,010 --> 00:00:28,680
Rust was designed to solve the problems present in other languages, while not unique.

8
00:00:28,770 --> 00:00:31,260
Rust is a statically typed language.

9
00:00:31,530 --> 00:00:36,810
These types of languages allow the compiler to run checks on our data and functions.

10
00:00:37,200 --> 00:00:40,500
Thus, we can catch errors during compilation.

11
00:00:40,860 --> 00:00:44,190
This feature does force developers to write more code.

12
00:00:44,550 --> 00:00:49,650
One of the most significant drawbacks of a statically typed language is readability.

13
00:00:50,070 --> 00:00:55,890
Rust introduces type inference to help with readability, which we'll talk about in a future lecture.

14
00:00:56,400 --> 00:01:00,330
Out of all the languages available, rust is highly memory efficient.

15
00:01:00,570 --> 00:01:05,220
If you are a JavaScript developer, memory may not be something you think about frequently.

16
00:01:05,550 --> 00:01:09,690
Whenever you define a variable, you're taking up memory on a user's machine.

17
00:01:10,020 --> 00:01:14,730
One variable is not going to kill a user's browser, but hundreds of them can.

18
00:01:15,330 --> 00:01:17,640
Rust emphasizes memory safety.

19
00:01:17,880 --> 00:01:21,750
A majority of popular languages employ a garbage collector.

20
00:01:22,020 --> 00:01:26,580
It's a program that continuously checks your application for unused memory.

21
00:01:26,850 --> 00:01:30,300
Garbage collectors can automate the action of freeing memory.

22
00:01:30,660 --> 00:01:34,560
The problem with garbage collectors is that they're slow and unpredictable.

23
00:01:34,800 --> 00:01:37,890
We don't have control when they run, when they do run.

24
00:01:37,980 --> 00:01:41,550
They require additional resources to handle freeing memory.

25
00:01:42,090 --> 00:01:45,750
Unlike other languages, Rust guarantees memory safety.

26
00:01:45,960 --> 00:01:48,900
It's completely aware of when memory should be free.

27
00:01:49,200 --> 00:01:51,300
Periodic checks are not performed.

28
00:01:51,630 --> 00:01:55,110
Instead, it knows exactly when memory can be released.

29
00:01:55,470 --> 00:01:58,020
Lastly, rust is highly performance.

30
00:01:58,260 --> 00:02:03,000
It's just as fast as C or Java, since it's a memory efficient language.

31
00:02:03,120 --> 00:02:05,640
You never have to pay for things you aren't using.

32
00:02:05,820 --> 00:02:08,789
If this sounds foreign to you, that's completely fine.

33
00:02:09,090 --> 00:02:13,050
Throughout this course, we'll get firsthand experience with these features.

34
00:02:13,320 --> 00:02:15,360
Let's move on to installing rust.

35
00:02:15,840 --> 00:02:19,680
If you're on a Mac or Linux, rust can be installed through the terminal.

36
00:02:19,890 --> 00:02:22,620
You should run these commands to begin the installation.

37
00:02:22,920 --> 00:02:25,980
After installation, a success message should appear.

38
00:02:26,280 --> 00:02:29,430
Rust is a relatively easy language to install.

39
00:02:30,810 --> 00:02:36,570
If you're on a Windows machine, the installation is slightly different in the resource section of this

40
00:02:36,570 --> 00:02:40,500
lecture, I provide a link to the installation page of Rust.

41
00:02:40,830 --> 00:02:44,340
Windows users can run a downloadable installer.

42
00:02:44,610 --> 00:02:47,670
There's a 32 and 64 bit version.

43
00:02:48,030 --> 00:02:52,740
In most cases, the 64 bit version should work for most users.

44
00:02:53,190 --> 00:02:55,800
Download the installer and run the installation.

45
00:02:56,340 --> 00:02:58,500
It's a standard installation process.

46
00:02:58,740 --> 00:03:01,620
Just click next until the program is installed.

47
00:03:01,920 --> 00:03:04,770
I'm going to quickly install rust on my machine.

48
00:03:06,230 --> 00:03:10,430
After installation, three tools are going to be installed on your system.

49
00:03:10,730 --> 00:03:13,010
They are accessible via the command line.

50
00:03:13,280 --> 00:03:15,680
The first tool is called Rust Up.

51
00:03:15,980 --> 00:03:19,010
It's a tool for managing different versions of rust.

52
00:03:19,370 --> 00:03:22,820
Other projects may require different versions of rust.

53
00:03:23,120 --> 00:03:26,840
Ideally, you want projects to run on the latest version.

54
00:03:27,140 --> 00:03:33,200
In some cases, you may need experimental or beta features through the rust up command.

55
00:03:33,350 --> 00:03:35,930
You can install a nightly version of Rust.

56
00:03:36,530 --> 00:03:38,570
The second tool is called Rust.

57
00:03:38,570 --> 00:03:43,940
C Rust needs to be compiled from human readable code to binary code.

58
00:03:44,270 --> 00:03:47,630
The Rust See Command will perform this process for you.

59
00:03:47,930 --> 00:03:52,220
Normally, you won't need to run this command because of the cargo tool.

60
00:03:52,820 --> 00:03:56,900
This command is responsible for managing dependencies for your project.

61
00:03:57,230 --> 00:04:00,560
It can also compile your projects behind the scenes.

62
00:04:00,680 --> 00:04:02,840
It runs the Rust See command.

63
00:04:03,080 --> 00:04:06,650
Therefore, you can skip running the Rust See commands.

64
00:04:07,520 --> 00:04:09,140
Let's explore these tools.

65
00:04:09,380 --> 00:04:14,660
We're going to skip the Rust See tool since the cargo command runs this tool for us.

66
00:04:14,930 --> 00:04:17,690
First, let's explore the Rust Up tool.

67
00:04:18,019 --> 00:04:21,959
Currently, I'm in an empty directory with the command line opened.

68
00:04:22,220 --> 00:04:29,000
If you're using Visual Studio code, you can open a new terminal by navigating to Terminal New Terminal.

69
00:04:29,570 --> 00:04:32,150
The rust up tool is not hard to use.

70
00:04:32,420 --> 00:04:35,510
It's very likely you'll be using it to upgrade rust.

71
00:04:35,750 --> 00:04:39,740
We can upgrade rust by typing the Rust Up Update Command.

72
00:04:42,200 --> 00:04:44,480
We've installed the latest version of Rust.

73
00:04:44,720 --> 00:04:49,340
It shouldn't take long for Rust to realize it doesn't have to update our project.

74
00:04:49,640 --> 00:04:55,790
In most cases, you will use the rust up command to upgrade your rust version, which I always recommend

75
00:04:55,790 --> 00:04:56,270
doing.

76
00:04:56,600 --> 00:04:59,060
New releases are frequent from the Rust team.

77
00:04:59,330 --> 00:05:04,400
In the resource section of this lecture, I provide a link to a book called Rust Up.

78
00:05:06,030 --> 00:05:11,520
One of the things I love about the Rus community is their effort to share basic knowledge with beginners.

79
00:05:11,850 --> 00:05:15,540
This book provides a basic overview of the Rust Up tool.

80
00:05:15,900 --> 00:05:18,580
It's completely free and aimed at newcomers.

81
00:05:18,870 --> 00:05:23,610
If you would like more information about this tool, I highly recommend reading this book.

82
00:05:24,180 --> 00:05:26,190
Let's move on to the cargo tool.

83
00:05:26,460 --> 00:05:28,620
Cargo is analogous to 21:00.

84
00:05:28,890 --> 00:05:32,280
Cargo is to rust, as 21:00 is to JavaScript.

85
00:05:32,520 --> 00:05:33,570
Simple, right?

86
00:05:33,930 --> 00:05:39,330
In the resource section of this lecture, I provide a link to a registry called Crates.

87
00:05:39,660 --> 00:05:43,320
You can find community contributed packages on this site.

88
00:05:43,650 --> 00:05:46,200
It's very popular with the Rust community.

89
00:05:46,500 --> 00:05:49,140
Almost nine billion downloads have been made.

90
00:05:49,800 --> 00:05:53,670
The crates tool has various commands for creating a project.

91
00:05:53,910 --> 00:05:55,050
Let's give it a try.

92
00:05:55,230 --> 00:05:57,030
Switch back to the command line.

93
00:05:59,570 --> 00:06:03,860
We can create a new project by typing the cargo in it commands.

94
00:06:06,370 --> 00:06:11,990
After a few seconds, the command should have generated a new project in the following lecture.

95
00:06:12,100 --> 00:06:16,030
We're going to begin exploring the project generated by Chicago.

