All right.
So now let's talk about what a move is.
A move sounds exactly like what it is called.
When you do a move, you move the ownership of the value from one variable to another and most types
implement a move.
So let's see an example of this.
We're going to create a vector, name it X, and we're going to just store in a string that contains
the value.
Tyler And then we're going to create a new variable called Y and assign it to X.
And now let's see what happens when we try to print out what X is.
And so this will air out.
And it's actually already.
Telling you like, hey, this isn't going to work.
So it says here we borrowed the borrow of a moved value x.
So it's saying that our move occurs at lines seven.
Her Line eight excuse me.
And then we try to reference the value that got moved in line nine, which is a violation of the ownership
rule.
Right.
Because we gave.
The value of X to Y, and then we try to reference the value that X had, but x no longer owns that
value.
Y now owns it.
And so the same thing would apply if we said Let Z equals Y.
So now if we come down here and now try to reference Y, it's going to tell us the same thing.
It says the move occurs because Y does not implement the copy tree.
The value was moved here in line nine and then we try to reference the borrowed value here after the
move, but it's going to let us run and use the Z value perfectly fine.
So as you can see now we have Tyler printed out.
So that's how a move works.
But now what exactly is a copy?
So let's take a look at how we can do deep and shallow copies of these values in the next lecture.