[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250522094936.1370073-1-ojeda@kernel.org>
Date: Thu, 22 May 2025 11:49:36 +0200
From: Miguel Ojeda <ojeda@...nel.org>
To: richard120310@...il.com
Cc: a.hindborg@...nel.org,
alex.gaynor@...il.com,
aliceryhl@...gle.com,
benno.lossin@...ton.me,
bjorn3_gh@...tonmail.com,
boqun.feng@...il.com,
dakr@...nel.org,
gary@...yguo.net,
jserv@...s.ncku.edu.tw,
linux-kernel-mentees@...ts.linux.dev,
linux-kernel@...r.kernel.org,
ojeda@...nel.org,
rust-for-linux@...r.kernel.org,
skhan@...uxfoundation.org,
tmgross@...ch.edu
Subject: Re: [RFC PATCH v2] rust: list: Add examples for linked list
On Tue, 11 Mar 2025 21:33:57 +0800 I Hsin Cheng <richard120310@...il.com> wrote:
>
> Add basic examples for the structure "List", also serve as the unit
> tests for basic list methods. Including the following manipulations:
> * List creation
> * List emptiness check
> * List insertion through push_front(), push_back()
> * List item removal through pop_front(), pop_back()
> * Push one list to another through push_all_back()
>
> The method "remove()" doesn't have an example here because insertion
> with push_front() or push_back() will take the ownership of the item,
> which means we can't keep any valid reference to the node we want to
> remove, unless Cursor is used. The remove example through Cursor is
> already demonstrate with 'commit 52ae96f5187c ("rust: list: make the
> cursor point between elements")' .
>
> Link: https://github.com/Rust-for-Linux/linux/issues/1121
> Signed-off-by: I Hsin Cheng <richard120310@...il.com>
Applied to `rust-next` -- thanks everyone!
[ Removed prelude import and spurious newlines. Formatted comments
with the usual style. Reworded slightly. - Miguel ]
Cheers,
Miguel
Powered by blists - more mailing lists