Skip to content

rust: linked_list: add usage example #937

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

Open
wants to merge 1 commit into
base: rust
Choose a base branch
from

Conversation

JoseExposito
Copy link

Hi!

Thanks for adding this "good first issue" tags, they are really useful to get started and start knowing the community members working on the project.

This PR addresses #345, adding and example that illustrates how to use the linked list using all of its methods.

I'm pretty new to Rust, so please feel free to point any issues. I'm looking forward to work on something a bit more difficult once I get some practice with the language.

@bjorn3
Copy link
Member

bjorn3 commented Dec 9, 2022

CI failure looks spurious.

Copy link
Member

@bjorn3 bjorn3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sulix
Copy link

sulix commented Dec 15, 2022

This looks like a great companion to lib/list-test.c, thanks!

I verified the doctests work with

./tools/testing/kunit/kunit.py run --kconfig_add CONFIG_RUST=y --make_options LLVM=1 --arch x86_64 rust_kernel_doctests.*linked_list*

…and it worked fine. It also helped me understand the linked_list type, so clearly a success.

So this is:

Reviewed-by: David Gow <[email protected]>

One possible idea for the future (though whether or not it fits best here as a doctest, I'm not sure) would be to add an example for having the same object be an element of multiple lists. That seems like something that'd benefit from an example at some point.

Illustrate how to use the linked list adding an example that uses all
methods the linked list currently supports.

Link: Rust-for-Linux#345
Reviewed-by: David Gow <[email protected]>
Signed-off-by: José Expósito <[email protected]>
@JoseExposito JoseExposito force-pushed the patch-rust-linked-list-examples branch from 329c4d2 to 4c6c989 Compare December 19, 2022 07:33
@JoseExposito
Copy link
Author

Thanks @sulix , I just added your reviewed-by :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants