Don't expose ZipImpl to Iterator

This commit is contained in:
Clar Fon 2018-12-17 21:19:24 -05:00
parent 52b36e28d8
commit 5971ccc08d
4 changed files with 5 additions and 5 deletions

View file

@ -13,7 +13,6 @@ mod zip;
pub use self::chain::Chain;
pub use self::flatten::{FlatMap, Flatten};
pub use self::zip::Zip;
pub(super) use self::zip::ZipImpl;
pub(crate) use self::zip::TrustedRandomAccess;
/// A double-ended iterator with the direction inverted.

View file

@ -19,6 +19,9 @@ pub struct Zip<A, B> {
len: usize,
}
impl<A: Iterator, B: Iterator> Zip<A, B> {
pub(in super::super) fn new(a: A, b: B) -> Zip<A, B> {
ZipImpl::new(a, b)
}
fn super_nth(&mut self, mut n: usize) -> Option<(A::Item, B::Item)> {
while let Some(x) = Iterator::next(self) {
if n == 0 { return Some(x) }
@ -62,7 +65,7 @@ impl<A, B> DoubleEndedIterator for Zip<A, B> where
// Zip specialization trait
#[doc(hidden)]
pub(in super::super) trait ZipImpl<A, B> {
trait ZipImpl<A, B> {
type Item;
fn new(a: A, b: B) -> Self;
fn next(&mut self) -> Option<Self::Item>;

View file

@ -353,7 +353,6 @@ pub use self::adapters::Flatten;
#[unstable(feature = "iter_copied", issue = "57127")]
pub use self::adapters::Copied;
use self::adapters::ZipImpl;
pub(crate) use self::adapters::TrustedRandomAccess;
mod range;

View file

@ -5,8 +5,7 @@ use super::super::LoopState;
use super::super::{Chain, Cycle, Copied, Cloned, Enumerate, Filter, FilterMap, Fuse};
use super::super::{Flatten, FlatMap};
use super::super::{Inspect, Map, Peekable, Scan, Skip, SkipWhile, StepBy, Take, TakeWhile, Rev};
use super::super::{Zip, Sum, Product};
use super::super::{FromIterator, ZipImpl};
use super::super::{Zip, Sum, Product, FromIterator};
fn _assert_is_object_safe(_: &dyn Iterator<Item=()>) {}