[PATCH v7 0/2] Make the Rust linked list cursor point between elements

From: Alice Ryhl
Date: Mon Feb 10 2025 - 04:54:49 EST


Please see the commit message of the last patch for more details and
motivation.

Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
---
Changes in v7:
- Fix missing `mut` in v6 as mentioned in reply.
- Rebase on v6.14-rc1.
- Link to v6: https://lore.kernel.org/r/20250131-cursor-between-v6-0-603bdc7d4449@xxxxxxxxxx

Changes in v6:
- Fix bug where Cursor::insert_inner does not update `self.list.first`
when inserting elements at the head of the list.
- Add a new `Cursor::insert` method. See its implementation for
justification.
- Link to v5: https://lore.kernel.org/r/20250127-cursor-between-v5-0-f7c388c23642@xxxxxxxxxx

Changes in v5:
- Fix list / list2 in example.
- Add remove_last function to example.
- Link to v4: https://lore.kernel.org/r/20250123-cursor-between-v4-0-cb06698db94c@xxxxxxxxxx

Changes in v4:
- Actually call the example functions.
- Link to v3: https://lore.kernel.org/r/20250122-cursor-between-v3-0-aaafbd8af14d@xxxxxxxxxx

Changes in v3:
- Fix `CursorPeek::deref` to use `self.ptr`.
- Reword comment on `ArcBorrow` in `impl Deref for CursorPeek`.
- Link to v2: https://lore.kernel.org/r/20250121-cursor-between-v2-0-1b24cd377618@xxxxxxxxxx

Changes in v2:
- Extract insert_inner refactor to separate patch.
- Make move_next/move_prev not wrap around.
- Add some examples.
- Link to v1: https://lore.kernel.org/r/20241025-cursor-between-v1-1-08913714aae5@xxxxxxxxxx

---
Alice Ryhl (2):
rust: list: extract common code for insertion
rust: list: make the cursor point between elements

rust/kernel/list.rs | 471 ++++++++++++++++++++++++++++++++++++++++++----------
1 file changed, 379 insertions(+), 92 deletions(-)
---
base-commit: 2014c95afecee3e76ca4a56956a936e23283f05b
change-id: 20241016-cursor-between-154bed859e27

Best regards,
--
Alice Ryhl <aliceryhl@xxxxxxxxxx>