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

Add more examples to Either #1122

Open
ojeda opened this issue Oct 1, 2024 · 2 comments
Open

Add more examples to Either #1122

ojeda opened this issue Oct 1, 2024 · 2 comments
Labels
easy Expected to be an easy issue to resolve. good first issue Good for newcomers • lib Related to the `rust/` library.

Comments

@ojeda
Copy link
Member

ojeda commented Oct 1, 2024

Add more examples to Either.

For instance, it would be nice to add a "real-life" example similar to Wedson's example on the filesystem abstractions' get_or_crate_inode proposal from his talk at LSF/MM/BPF 2024, i.e. something like:

fn get_or_create_inode(&self, ino: Ino) -> Result<Either<ARef<INode<T>>, inode::New<T>>>

See https://rust-for-linux.zulipchat.com/#narrow/stream/291565-Help/topic/What.20to.20work.20on.20next.3F/near/467478085.


This requires submitting a proper patch to the LKML and the Rust for Linux mailing list. Please recall to test your changes (including generating the documentation if changed, running the Rust doctests if changed, etc.), to use a proper title for the commit, to sign your commit under the Developer's Certificate of Origin and to add a Suggested-by: tag and a Link: tag to this issue. Please see https://rust-for-linux.com/contributing for details.

Please take this issue only if you are new to the kernel development process and you would like to use it as a test to submit your first patch to the kernel. Please do not take it if you do not plan to make other contributions to the kernel.

@ojeda ojeda added • lib Related to the `rust/` library. good first issue Good for newcomers easy Expected to be an easy issue to resolve. labels Oct 1, 2024
@Timgrau
Copy link

Timgrau commented Oct 6, 2024

Hey @ojeda, im working on this.

@ojeda
Copy link
Member Author

ojeda commented Oct 6, 2024

Thanks for letting me know @Timgrau, that is great.

intel-lab-lkp pushed a commit to intel-lab-lkp/linux that referenced this issue Oct 7, 2024
Added a 'real-life' example for the type `Either`. This example
uses a work queue and extends the first example in `workqueue.rs`
(commit ID: 15b286d) to demonstrate how to hold and distinguish
between two different data types.

Suggested-by: Miguel Ojeda <[email protected]>
Link: Rust-for-Linux#1122
Signed-off-by: Timo Grautstueck <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy Expected to be an easy issue to resolve. good first issue Good for newcomers • lib Related to the `rust/` library.
Development

No branches or pull requests

2 participants