From 6d95ffcfd87287a485f5f5724afe625b90b24d51 Mon Sep 17 00:00:00 2001 From: landaudiogo Date: Thu, 20 Jul 2023 14:53:18 +0100 Subject: [PATCH] Update sixth-cursors-intro.md Code snippet was calling next on an instance of linked list. I believe the author intended to call `iter.next()` instead of `list.next()` --- src/sixth-cursors-intro.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sixth-cursors-intro.md b/src/sixth-cursors-intro.md index b4522c0..73fb977 100644 --- a/src/sixth-cursors-intro.md +++ b/src/sixth-cursors-intro.md @@ -22,8 +22,8 @@ Hey, we already have iterators! Can we use them for this? Kind of... but one of ```rust ,ignore let mut list = ...; let iter = list.iter_mut(); -let elem1 = list.next(); -let elem2 = list.next(); +let elem1 = iter.next(); +let elem2 = iter.next(); if elem1 == elem2 { ... } ``` @@ -120,4 +120,4 @@ I have my quibbles with some of the terminology std uses, but cursors are always The std API talks about operations before "before" (towards the front) and "after" (towards the back), and instead of `next` and `next_back`, it... calls things `move_next` and `move_prev`. HRM. Ok so they're getting into a bit of the iterator terminology, but at least `next` doesn't evoke front/back, and helps you orient how things behave compared to the iterators. -We can work with this. \ No newline at end of file +We can work with this.