Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cordyceps: make cursor interface (mostly) match std #227

Merged
merged 13 commits into from
Jun 18, 2022
Merged

Conversation

hawkw
Copy link
Owner

@hawkw hawkw commented Jun 18, 2022

This implements most of the std::collections::linked_list::Cursor, with the following exceptions:

  • No CursorMut::splice_ methods because I want to implement those separately
  • No CursorMut::to_cursor methods because we only have a CursorMut type (and adding a Cursor type would be breaking, because it would require renaming Cursor)

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 18, 2022
This adds `peek_next` and `peek_prev` methods to
`cordyceps::list::Cursor`, similar to the methods on
`std::collections::linked_list::Cursor`.

Closes #224

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 18, 2022
This adds a `Cursor::remove_current` method, similar to the one on
`std::collections::linked_list::CursorMut`. I also reimplemented
`remove_first` to use this.

Closes #224

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 18, 2022
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added 10 commits June 18, 2022 13:06
This adds `Cursor::current` and `Cursor::current_mut` methods, similar
to the ones on `std::collections::linked_list::CursorMut`.

Closes #224

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
This adds `peek_next` and `peek_prev` methods to
`cordyceps::list::Cursor`, similar to the methods on
`std::collections::linked_list::Cursor`.

Closes #224

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
This adds a `Cursor::remove_current` method, similar to the one on
`std::collections::linked_list::CursorMut`. I also reimplemented
`remove_first` to use this.

Closes #224

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
This adds a `Cursor::remove_current` method, similar to the one on
`std::collections::linked_list::CursorMut`. I also reimplemented
`remove_first` to use this.

Closes #224

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
This renames `List::cursor` to `List::cursor_front_mut` to prepare for
adding a `List::cursor_back_mut` and `cursor_front`/`cursor_back`,
similarly to `std::collections::LinkedList`'s cursor methods.

`List::cursor` is now deprecated.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
This adds `List::cursor_back_mut` returning a mutable cursor at the back
of the list.

Closes #224

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
This adds a `Cursor::index` method to match the one on
`std::collections::linked_list::CursorMut`.

Closes #224

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
This adds `Cursor::insert_before` and `Cursor::insert_after` methods to
match the ones on `std::collections::linked_list::CursorMut`.

Closes #224

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
@hawkw hawkw enabled auto-merge (rebase) June 18, 2022 20:10
This replaces the use of `cordyceps::List::cursor` with
`cordyceps::List::cursor_front_mut`.
@hawkw hawkw requested a review from jamesmunns June 18, 2022 20:12
@hawkw hawkw merged commit 7024d6f into main Jun 18, 2022
@hawkw hawkw deleted the eliza/good-cursors branch June 18, 2022 20:20
hawkw added a commit that referenced this pull request Jun 18, 2022
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 18, 2022
This adds `Cursor::current` and `Cursor::current_mut` methods, similar
to the ones on `std::collections::linked_list::CursorMut`.

Closes #224

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 18, 2022
This adds `peek_next` and `peek_prev` methods to
`cordyceps::list::Cursor`, similar to the methods on
`std::collections::linked_list::Cursor`.

Closes #224

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 18, 2022
This adds a `Cursor::remove_current` method, similar to the one on
`std::collections::linked_list::CursorMut`. I also reimplemented
`remove_first` to use this.

Closes #224

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 18, 2022
This adds a `Cursor::remove_current` method, similar to the one on
`std::collections::linked_list::CursorMut`. I also reimplemented
`remove_first` to use this.

Closes #224

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 18, 2022
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 18, 2022
This renames `List::cursor` to `List::cursor_front_mut` to prepare for
adding a `List::cursor_back_mut` and `cursor_front`/`cursor_back`,
similarly to `std::collections::LinkedList`'s cursor methods.

`List::cursor` is now deprecated.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 18, 2022
This adds `List::cursor_back_mut` returning a mutable cursor at the back
of the list.

Closes #224

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 18, 2022
This adds a `Cursor::index` method to match the one on
`std::collections::linked_list::CursorMut`.

Closes #224

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 18, 2022
This adds `Cursor::insert_before` and `Cursor::insert_after` methods to
match the ones on `std::collections::linked_list::CursorMut`.

Closes #224

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 18, 2022
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 18, 2022
This renames `List::cursor` to `List::cursor_front_mut` to prepare for
adding a `List::cursor_back_mut` and `cursor_front`/`cursor_back`,
similarly to `std::collections::LinkedList`'s cursor methods.

DEPRECATED:

`List::cursor`, renamed to `List::cursor_front_mut`.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 18, 2022
This adds `List::cursor_back_mut` returning a mutable cursor at the back
of the list.

Closes #224

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 18, 2022
This adds a `Cursor::index` method to match the one on
`std::collections::linked_list::CursorMut`.

Closes #224

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 18, 2022
This adds `Cursor::insert_before` and `Cursor::insert_after` methods to
match the ones on `std::collections::linked_list::CursorMut`.

Closes #224

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 18, 2022
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 18, 2022
This replaces the use of `cordyceps::List::cursor` with
`cordyceps::List::cursor_front_mut`.
hawkw added a commit that referenced this pull request Jun 21, 2022
This renames `List::cursor` to `List::cursor_front_mut` to prepare for
adding a `List::cursor_back_mut` and `cursor_front`/`cursor_back`,
similarly to `std::collections::LinkedList`'s cursor methods.

Deprecates `List::cursor`.

DEPRECATED:

`List::cursor`, renamed to `List::cursor_front_mut`.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 21, 2022
This adds `List::cursor_back_mut` returning a mutable cursor at the back
of the list.

Closes #224

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 21, 2022
This adds a `Cursor::index` method to match the one on
`std::collections::linked_list::CursorMut`.

Closes #224

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 21, 2022
This adds `Cursor::insert_before` and `Cursor::insert_after` methods to
match the ones on `std::collections::linked_list::CursorMut`.

Closes #224

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 21, 2022
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
hawkw added a commit that referenced this pull request Jun 21, 2022
This replaces the use of `cordyceps::List::cursor` with
`cordyceps::List::cursor_front_mut`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant