diff options
author | Danilo Krummrich <dakr@kernel.org> | 2024-07-23 18:59:07 +0200 |
---|---|---|
committer | Danilo Krummrich <dakr@kernel.org> | 2024-10-08 16:27:50 +0200 |
commit | 09403321710d94abaa3e12a07eb5391490117bd4 (patch) | |
tree | bf5cf0f6349c53d57396ffeb4346d632f41ed3be /mm/ksm.c | |
parent | c52da76703ca7e646fead341c8203eef3827394a (diff) |
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
correspondingsly 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>
Diffstat (limited to 'mm/ksm.c')
0 files changed, 0 insertions, 0 deletions