Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Don't expose ZipImpl to Iterator
  • Loading branch information
Clar Fon committed Jan 22, 2019
commit 5971ccc08d8bfadeb0614c4555ffd32c51066cdc
1 change: 0 additions & 1 deletion src/libcore/iter/adapters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion src/libcore/iter/adapters/zip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down Expand Up @@ -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>;
Expand Down
1 change: 0 additions & 1 deletion src/libcore/iter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/libcore/iter/traits/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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=()>) {}

Expand Down