Rollup merge of #89053 - DeveloperC286:into_iter_fields_to_private, r=Mark-Simulacrum

refactor: VecDeques IntoIter fields to private

Made the fields of VecDeque's IntoIter private by creating a IntoIter::from(...) function to create a new instance of IntoIter and migrating usage to use IntoIter::from(...).
This commit is contained in:
Yuki Okushi 2021-09-19 17:31:34 +09:00 committed by GitHub
commit e4dbe27235
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View 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")]

View 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)
}
}