1 00:00:07,280 --> 00:00:14,960 Something that we need to do for our link list is we need to implement the drop tree so we can do that 2 00:00:14,960 --> 00:00:26,810 by saying t drop for list T, And the reason we need to implement the drop trait for our list is because 3 00:00:26,810 --> 00:00:29,870 the drop would be done recursively. 4 00:00:30,020 --> 00:00:34,040 So if you think about it, if we if we drop here. 5 00:00:34,220 --> 00:00:36,530 So so let's say we drop three. 6 00:00:36,770 --> 00:00:40,790 Well three is going to then drop to two isn't going to drop one. 7 00:00:40,790 --> 00:00:43,490 Well this sounds an awful lot like recursion. 8 00:00:44,120 --> 00:00:50,210 Well, imagine if we had a really large list that we're doing this recursive drop on. 9 00:00:51,620 --> 00:00:58,940 What what could happen with a large list that is recursively being dropped? 10 00:00:59,060 --> 00:01:05,660 Well, the recursion could potentially blow the stack up, and that is really bad. 11 00:01:05,660 --> 00:01:12,170 So what we need to do is we need to do an iterative drop to avoid using the recursive drop. 12 00:01:12,380 --> 00:01:19,070 So for us to do that, we're going to need to implement in the drop method. 13 00:01:21,140 --> 00:01:28,600 And here we'll say let a mutable link equal to self head take. 14 00:01:28,610 --> 00:01:43,850 So take the head and then while let some and then we'll say mute boxed node is going to equal our link. 15 00:01:45,900 --> 00:01:54,030 And then inside this code block we're going to say link is equal to box node dot, next dot take. 16 00:01:55,050 --> 00:01:58,500 So what we're doing here is we're going to do an iterative drop. 17 00:01:59,100 --> 00:02:08,850 That way, we don't have any chance to blow our stack using the recursive drop that rust would have 18 00:02:08,850 --> 00:02:12,480 done for us had we not implemented in our own drop. 19 00:02:13,110 --> 00:02:19,980 So that is just something that I wanted to point out that we needed to do in case our list ever grew 20 00:02:19,980 --> 00:02:26,550 to a large enough size where a recursive drop would have caused our stack to blow up. 21 00:02:26,820 --> 00:02:32,580 So in the next lecture, we're going to start looking at implementing an additional methods for our 22 00:02:32,580 --> 00:02:33,870 linked list.