summaryrefslogtreecommitdiffstats
path: root/scripts/generate_rust_analyzer.py
diff options
context:
space:
mode:
authorDanilo Krummrich <dakr@kernel.org>2024-10-04 17:41:21 +0200
committerMiguel Ojeda <ojeda@kernel.org>2024-10-15 23:10:32 +0200
commit1d1d223aa3b37c34271aefc2706340d0843bfcb2 (patch)
tree9846f4ed7c0058e53ec1b5d785385e1a11a35dd2 /scripts/generate_rust_analyzer.py
parent2aac4cd7dae3d7bb0e0ddec2561b2ee4cbe6c8f6 (diff)
downloadlinux-1d1d223aa3b37c34271aefc2706340d0843bfcb2.tar.gz
linux-1d1d223aa3b37c34271aefc2706340d0843bfcb2.tar.bz2
linux-1d1d223aa3b37c34271aefc2706340d0843bfcb2.zip
rust: alloc: implement `IntoIterator` for `Vec`
Implement `IntoIterator` for `Vec`, `Vec`'s `IntoIter` type, as well as `Iterator` for `IntoIter`. `Vec::into_iter` disassembles the `Vec` into its raw parts; additionally, `IntoIter` keeps track of a separate pointer, which is incremented correspondingly as the iterator advances, while the length, or the count of elements, is decremented. This also means that `IntoIter` takes the ownership of the backing buffer and is responsible to drop the remaining elements and free the backing buffer, if it's dropped. Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Benno Lossin <benno.lossin@proton.me> Reviewed-by: Gary Guo <gary@garyguo.net> Signed-off-by: Danilo Krummrich <dakr@kernel.org> Link: https://lore.kernel.org/r/20241004154149.93856-18-dakr@kernel.org [ Fixed typos. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'scripts/generate_rust_analyzer.py')
0 files changed, 0 insertions, 0 deletions