]> git.lizzy.rs Git - rust.git/commitdiff
refactor: VecDeques IntoIter fields to private
authorDeveloperC286 <DeveloperC@protonmail.com>
Fri, 17 Sep 2021 19:48:34 +0000 (20:48 +0100)
committerDeveloperC286 <DeveloperC@protonmail.com>
Fri, 17 Sep 2021 20:46:32 +0000 (21:46 +0100)
library/alloc/src/collections/vec_deque/into_iter.rs
library/alloc/src/collections/vec_deque/mod.rs

index 5f13c3bf30387bdb74c75ad497c00c35533a797f..54a157be0b96acdfecab5838f1385f0c1b939db1 100644 (file)
@@ -17,7 +17,13 @@ pub struct IntoIter<
     T,
     #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
 > {
-    pub(crate) inner: VecDeque<T, A>,
+    inner: VecDeque<T, A>,
+}
+
+impl<T, A: Allocator> IntoIter<T, A> {
+    pub(super) fn new(inner: VecDeque<T, A>) -> Self {
+        IntoIter { inner }
+    }
 }
 
 #[stable(feature = "collection_debug", since = "1.17.0")]
index e4b28204158d9d3372ade952b5487eb1e96ebfd7..10144cc17bf306579ccc1b4e2272fb86b11a644d 100644 (file)
@@ -2827,7 +2827,7 @@ impl<T, A: Allocator> IntoIterator for VecDeque<T, A> {
     /// Consumes the `VecDeque` into a front-to-back iterator yielding elements by
     /// value.
     fn into_iter(self) -> IntoIter<T, A> {
-        IntoIter { inner: self }
+        IntoIter::new(self)
     }
 }