Skip to content

TodoList Search Items#1

Open
Syvven wants to merge 4 commits intoUMN-Kernel-Object:mainfrom
Syvven:search
Open

TodoList Search Items#1
Syvven wants to merge 4 commits intoUMN-Kernel-Object:mainfrom
Syvven:search

Conversation

@Syvven
Copy link

@Syvven Syvven commented Oct 27, 2023

Overview

This PR implements the TodoList::search() function.
The items vector is filtered using comparisons between options,
leveraging the properties of comparing Some() to None to not
use if let statements or more verbose methods.
Additionally, proper testing of the function was done for a variety
of circumstances, including a performance test in order to compare
against other versions other contributors may be working on.
To see output of the timing test, one can use the command:

cargo test timing_test -- --nocapture

A small add_full_item() function was also added to facilitate with testing.

One thing I was unsure on was the cloning of the items at the end of the search function.
Removing that cloning requires the function to return Vec<(usize, &Item)>
instead of Vec<(usize, Item)>. Is this a fair tradeoff to make? Is one or the other
considered better practice when writing rust code?

As always, feedback is appreciated!

- Noah Hendrickson

Signed-off-by: Noah Hendrickson <nhendrickson2001@gmail.com>
Signed-off-by: Noah Hendrickson <nhendrickson2001@gmail.com>
Signed-off-by: Noah Hendrickson <nhendrickson2001@gmail.com>
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