diff options
| author | The 8472 <git@infinite-source.de> | 2022-07-30 01:48:16 +0200 |
|---|---|---|
| committer | The 8472 <git@infinite-source.de> | 2023-02-28 21:00:00 +0100 |
| commit | 05c7330ca03650bbcb6a55f5fa490b3bb03c1940 (patch) | |
| tree | b7ace4e112ca9e379342f60cd877fbb40211b400 /library/alloc/src/collections/binary_heap | |
| parent | 31f858d9a511f24fedb8ed997b28304fec809630 (diff) | |
| download | rust-05c7330ca03650bbcb6a55f5fa490b3bb03c1940.tar.gz rust-05c7330ca03650bbcb6a55f5fa490b3bb03c1940.zip | |
Implement Default for some alloc/core iterators
This way one can `mem::take()` them out of structs or #[derive(Default)] on structs containing them. These changes will be insta-stable.
Diffstat (limited to 'library/alloc/src/collections/binary_heap')
| -rw-r--r-- | library/alloc/src/collections/binary_heap/mod.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/library/alloc/src/collections/binary_heap/mod.rs b/library/alloc/src/collections/binary_heap/mod.rs index f1d0a305d99..b0ec70ad565 100644 --- a/library/alloc/src/collections/binary_heap/mod.rs +++ b/library/alloc/src/collections/binary_heap/mod.rs @@ -1468,6 +1468,13 @@ impl<T> ExactSizeIterator for IntoIter<T> { #[stable(feature = "fused", since = "1.26.0")] impl<T> FusedIterator for IntoIter<T> {} +#[stable(feature = "default_iters", since = "CURRENT_RUSTC_VERSION")] +impl<T> Default for IntoIter<T> { + fn default() -> Self { + IntoIter { iter: Default::default() } + } +} + // In addition to the SAFETY invariants of the following three unsafe traits // also refer to the vec::in_place_collect module documentation to get an overview #[unstable(issue = "none", feature = "inplace_iteration")] |
