diff options
| author | Danilo Krummrich <[email protected]> | 2024-10-04 15:41:21 +0000 |
|---|---|---|
| committer | Miguel Ojeda <[email protected]> | 2024-10-15 21:10:32 +0000 |
| commit | 1d1d223aa3b37c34271aefc2706340d0843bfcb2 (patch) | |
| tree | 9846f4ed7c0058e53ec1b5d785385e1a11a35dd2 /rust/macros/lib.rs | |
| parent | rust: alloc: implement kernel `Vec` type (diff) | |
| download | kernel-1d1d223aa3b37c34271aefc2706340d0843bfcb2.tar.gz kernel-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 <[email protected]>
Reviewed-by: Benno Lossin <[email protected]>
Reviewed-by: Gary Guo <[email protected]>
Signed-off-by: Danilo Krummrich <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[ Fixed typos. - Miguel ]
Signed-off-by: Miguel Ojeda <[email protected]>
Diffstat (limited to 'rust/macros/lib.rs')
0 files changed, 0 insertions, 0 deletions
