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

feat(cordyceps): add some list surgery methods #233

Merged
merged 4 commits into from
Jun 20, 2022
Merged

Conversation

hawkw
Copy link
Owner

@hawkw hawkw commented Jun 19, 2022

This adds List::append, List::split_off, and Cursor::split_before/split_after.

hawkw added 2 commits June 19, 2022 12:02
The `fmt::Debug` impl for `List` didn't include the length. This fixes
that.

Signed-off-by: Eliza Weisman <[email protected]>
hawkw added a commit that referenced this pull request Jun 19, 2022
This commit adds a `List::split_off` method to `cordyceps::List`,
similar to the one on `std::collections::LinkedList`.

Signed-off-by: Eliza Weisman <[email protected]>
hawkw added a commit that referenced this pull request Jun 19, 2022
This commit adds `split_before` and `split_after` methods to
`cordyceps::list::Cursor`, similar to the ones on
`std::collections::linked_list::CursorMut`.

Signed-off-by: Eliza Weisman <[email protected]>
@hawkw hawkw force-pushed the eliza/list-surgery branch from a0ebde5 to 07420a8 Compare June 19, 2022 19:02
@hawkw hawkw enabled auto-merge (rebase) June 19, 2022 19:03
hawkw added 2 commits June 19, 2022 16:56
This commit adds a `List::split_off` method to `cordyceps::List`,
similar to the one on `std::collections::LinkedList`. Additionally, it
adds a `try_split_off` method that doesn't panic if the split index is
greater than the list's length, and returns an `Option` instead ---
`std::collections::LinkedList` doesn't have this, but I thought it was
kinda nice.

Signed-off-by: Eliza Weisman <[email protected]>
This commit adds `split_before` and `split_after` methods to
`cordyceps::list::Cursor`, similar to the ones on
`std::collections::linked_list::CursorMut`.

Signed-off-by: Eliza Weisman <[email protected]>
@hawkw hawkw force-pushed the eliza/list-surgery branch from 07420a8 to a60bcb4 Compare June 19, 2022 23:56
@hawkw hawkw merged commit d9af072 into main Jun 20, 2022
@hawkw hawkw deleted the eliza/list-surgery branch June 20, 2022 00:05
hawkw added a commit that referenced this pull request Jun 20, 2022
hawkw added a commit that referenced this pull request Jun 20, 2022
The `fmt::Debug` impl for `List` didn't include the length. This fixes
that.

Signed-off-by: Eliza Weisman <[email protected]>
hawkw added a commit that referenced this pull request Jun 20, 2022
This commit adds a `List::split_off` method to `cordyceps::List`,
similar to the one on `std::collections::LinkedList`. Additionally, it
adds a `try_split_off` method that doesn't panic if the split index is
greater than the list's length, and returns an `Option` instead ---
`std::collections::LinkedList` doesn't have this, but I thought it was
kinda nice.

Signed-off-by: Eliza Weisman <[email protected]>
hawkw added a commit that referenced this pull request Jun 21, 2022
hawkw added a commit that referenced this pull request Jun 21, 2022
The `fmt::Debug` impl for `List` didn't include the length. This fixes
that.

Signed-off-by: Eliza Weisman <[email protected]>
hawkw added a commit that referenced this pull request Jun 21, 2022
This commit adds a `List::split_off` method to `cordyceps::List`,
similar to the one on `std::collections::LinkedList`. Additionally, it
adds a `try_split_off` method that doesn't panic if the split index is
greater than the list's length, and returns an `Option` instead ---
`std::collections::LinkedList` doesn't have this, but I thought it was
kinda nice.

Signed-off-by: Eliza Weisman <[email protected]>
hawkw added a commit that referenced this pull request Jun 21, 2022
This commit adds `split_before` and `split_after` methods to
`cordyceps::list::Cursor`, similar to the ones on
`std::collections::linked_list::CursorMut`.

Signed-off-by: Eliza Weisman <[email protected]>
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.

1 participant