1 00:00:05,930 --> 00:00:06,380 All right. 2 00:00:06,380 --> 00:00:09,170 So now let's talk about what a move is. 3 00:00:09,830 --> 00:00:13,550 A move sounds exactly like what it is called. 4 00:00:13,670 --> 00:00:22,280 When you do a move, you move the ownership of the value from one variable to another and most types 5 00:00:22,280 --> 00:00:23,300 implement a move. 6 00:00:23,900 --> 00:00:25,640 So let's see an example of this. 7 00:00:25,820 --> 00:00:35,750 We're going to create a vector, name it X, and we're going to just store in a string that contains 8 00:00:35,750 --> 00:00:36,500 the value. 9 00:00:36,740 --> 00:00:42,110 Tyler And then we're going to create a new variable called Y and assign it to X. 10 00:00:42,350 --> 00:00:48,260 And now let's see what happens when we try to print out what X is. 11 00:00:49,840 --> 00:00:53,750 And so this will air out. 12 00:00:53,750 --> 00:00:54,800 And it's actually already. 13 00:00:55,470 --> 00:00:57,600 Telling you like, hey, this isn't going to work. 14 00:00:58,320 --> 00:01:04,110 So it says here we borrowed the borrow of a moved value x. 15 00:01:04,110 --> 00:01:08,040 So it's saying that our move occurs at lines seven. 16 00:01:09,300 --> 00:01:10,680 Her Line eight excuse me. 17 00:01:10,680 --> 00:01:20,760 And then we try to reference the value that got moved in line nine, which is a violation of the ownership 18 00:01:20,760 --> 00:01:21,000 rule. 19 00:01:21,000 --> 00:01:21,230 Right. 20 00:01:21,240 --> 00:01:22,260 Because we gave. 21 00:01:23,220 --> 00:01:29,880 The value of X to Y, and then we try to reference the value that X had, but x no longer owns that 22 00:01:29,880 --> 00:01:30,480 value. 23 00:01:30,510 --> 00:01:32,910 Y now owns it. 24 00:01:33,600 --> 00:01:39,070 And so the same thing would apply if we said Let Z equals Y. 25 00:01:39,090 --> 00:01:44,460 So now if we come down here and now try to reference Y, it's going to tell us the same thing. 26 00:01:44,460 --> 00:01:48,930 It says the move occurs because Y does not implement the copy tree. 27 00:01:49,780 --> 00:01:57,400 The value was moved here in line nine and then we try to reference the borrowed value here after the 28 00:01:57,400 --> 00:02:04,210 move, but it's going to let us run and use the Z value perfectly fine. 29 00:02:04,210 --> 00:02:07,630 So as you can see now we have Tyler printed out. 30 00:02:07,630 --> 00:02:09,640 So that's how a move works. 31 00:02:09,640 --> 00:02:12,820 But now what exactly is a copy? 32 00:02:12,820 --> 00:02:22,120 So let's take a look at how we can do deep and shallow copies of these values in the next lecture.