1 00:00:06,600 --> 00:00:09,630 - Hi, welcome to lesson 15. 2 00:00:09,630 --> 00:00:12,570 In this lesson, we're going to dig a bit deeper 3 00:00:12,570 --> 00:00:16,770 into Rust details and see some of its advanced topics 4 00:00:16,770 --> 00:00:19,080 that it has in store for us. 5 00:00:19,080 --> 00:00:21,510 We'll begin with a look at boxing. 6 00:00:21,510 --> 00:00:24,060 In a nutshell, a box is a smart pointer 7 00:00:24,060 --> 00:00:27,390 to an object allocated dynamically on heap. 8 00:00:27,390 --> 00:00:30,630 We'll have a look at a simple example of boxing first, 9 00:00:30,630 --> 00:00:32,820 then we'll see a more realistic example 10 00:00:32,820 --> 00:00:35,523 of why you might use boxing in practice. 11 00:00:36,600 --> 00:00:40,170 The next topic we look at is reference counting. 12 00:00:40,170 --> 00:00:43,740 Rust defines a reference count construct, called RC, 13 00:00:43,740 --> 00:00:45,900 that keeps count of how many references you have 14 00:00:45,900 --> 00:00:47,430 to an object. 15 00:00:47,430 --> 00:00:49,740 Each time a reference goes at a scope, 16 00:00:49,740 --> 00:00:51,600 the counter is decremented. 17 00:00:51,600 --> 00:00:53,490 And when the reference count goes to zero, 18 00:00:53,490 --> 00:00:56,313 the underlying object is automatically deallocated. 19 00:00:57,720 --> 00:01:01,830 Next up, we discuss the concept of unsafe code. 20 00:01:01,830 --> 00:01:03,630 This is a mechanism that enables you 21 00:01:03,630 --> 00:01:07,260 to bypass the normal protection offered by Rust 22 00:01:07,260 --> 00:01:08,850 to perform low level operations, 23 00:01:08,850 --> 00:01:12,333 such as accessing raw addresses in memory directly. 24 00:01:13,650 --> 00:01:16,440 To finish off the lesson, we'll show how to integrate Rust 25 00:01:16,440 --> 00:01:18,390 with other programming languages, 26 00:01:18,390 --> 00:01:21,510 we'll see how to call other languages from Rust 27 00:01:21,510 --> 00:01:24,600 and we'll also see how to make our Rust code callable 28 00:01:24,600 --> 00:01:27,063 from other languages in the opposite direction.