Skip to content

Commit

Permalink
Address some of the comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen-CH-Leung committed May 17, 2024
1 parent 5a1f1a9 commit 3fab1c2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
4 changes: 1 addition & 3 deletions src/free.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ pub use crate::adaptors::{interleave, put_back};
pub use crate::kmerge_impl::kmerge;
pub use crate::merge_join::{merge, merge_join_by};
#[cfg(feature = "use_alloc")]
pub use crate::multipeek_general::multipeek;
#[cfg(feature = "use_alloc")]
pub use crate::multipeek_general::peek_nth;
pub use crate::multipeek_general::{multipeek, peek_nth};
#[cfg(feature = "use_alloc")]
pub use crate::put_back_n_impl::put_back_n;
#[cfg(feature = "use_alloc")]
Expand Down
4 changes: 1 addition & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ pub mod structs {
pub use crate::kmerge_impl::{KMerge, KMergeBy};
pub use crate::merge_join::{Merge, MergeBy, MergeJoinBy};
#[cfg(feature = "use_alloc")]
pub use crate::multipeek_general::MultiPeek;
#[cfg(feature = "use_alloc")]
pub use crate::multipeek_general::PeekNth;
pub use crate::multipeek_general::{MultiPeek, PeekNth};
pub use crate::pad_tail::PadUsing;
pub use crate::peeking_take_while::PeekingTakeWhile;
#[cfg(feature = "use_alloc")]
Expand Down
15 changes: 6 additions & 9 deletions src/multipeek_general.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
#![allow(private_interfaces)]
#![allow(private_bounds)]

use crate::{size_hint, PeekingNext};
use alloc::collections::VecDeque;
use std::iter::Fuse;

/// See [`multipeek()`] for more information.
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[derive(Debug, Clone)]
pub struct MultiPeekGeneral<I: Iterator, Idx> {
pub iter: Fuse<I>,
pub buf: VecDeque<I::Item>,
pub index: Idx,
iter: Fuse<I>,
buf: VecDeque<I::Item>,
index: Idx,
}

/// See [`multipeek()`] for more information.
Expand All @@ -23,7 +19,7 @@ pub type PeekNth<I> = MultiPeekGeneral<I, ()>;
/// An iterator adaptor that allows the user to peek at multiple `.next()`
/// values without advancing the base iterator.
///
/// [`IntoIterator`] enabled version of [`crate::Itertools::multipeek`].
/// [`IntoIterator`] enabled version of [`Itertools::multipeek`](crate::Itertools::multipeek).
pub fn multipeek<I>(iterable: I) -> MultiPeek<I::IntoIter>
where
I: IntoIterator,
Expand Down Expand Up @@ -241,9 +237,10 @@ impl<I: Iterator, Idx: PeekIndex> Iterator for MultiPeekGeneral<I, Idx> {

impl<I: ExactSizeIterator, Idx: PeekIndex> ExactSizeIterator for MultiPeekGeneral<I, Idx> {}

impl<I: Iterator, Idx: PeekIndex> PeekingNext for MultiPeekGeneral<I, Idx>
impl<I, Idx> PeekingNext for MultiPeekGeneral<I, Idx>
where
I: Iterator,
Idx: PeekIndex,
{
fn peeking_next<F>(&mut self, accept: F) -> Option<Self::Item>
where
Expand Down

0 comments on commit 3fab1c2

Please sign in to comment.