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.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
The `fmt::Debug` impl for `List` didn't include the length. This fixes
that.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
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 <eliza@buoyant.io>
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 <eliza@buoyant.io>
@hawkw hawkw enabled auto-merge (rebase) June 19, 2022 19:03
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 <eliza@buoyant.io>
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 <eliza@buoyant.io>
@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
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
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 <eliza@buoyant.io>
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 <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
The `fmt::Debug` impl for `List` didn't include the length. This fixes
that.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
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 <eliza@buoyant.io>
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 <eliza@buoyant.io>
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