Skip to content

Commit

Permalink
Revert "add stream::min_by method (#146)"
Browse files Browse the repository at this point in the history
This reverts commit 7e3599a.
  • Loading branch information
Stjepan Glavina authored Sep 6, 2019
1 parent 5d73776 commit 0d5f540
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 90 deletions.
54 changes: 0 additions & 54 deletions src/stream/min_by.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/stream/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ pub use repeat::{repeat, Repeat};
pub use stream::{Stream, Take};

mod empty;
mod min_by;
mod once;
mod repeat;
mod stream;
35 changes: 0 additions & 35 deletions src/stream/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@
//! # }) }
//! ```
use std::cmp::Ordering;
use std::pin::Pin;

use cfg_if::cfg_if;

use super::min_by::MinBy;
use crate::future::Future;
use crate::task::{Context, Poll};
use std::marker::PhantomData;
Expand Down Expand Up @@ -120,39 +118,6 @@ pub trait Stream {
}
}

/// Returns the element that gives the minimum value with respect to the
/// specified comparison function. If several elements are equally minimum,
/// the first element is returned. If the stream is empty, `None` is returned.
///
/// # Examples
///
/// ```
/// # fn main() { async_std::task::block_on(async {
/// #
/// use std::collections::VecDeque;
/// use async_std::stream::Stream;
///
/// let s: VecDeque<usize> = vec![1, 2, 3].into_iter().collect();
///
/// let min = Stream::min_by(s.clone(), |x, y| x.cmp(y)).await;
/// assert_eq!(min, Some(1));
///
/// let min = Stream::min_by(s, |x, y| y.cmp(x)).await;
/// assert_eq!(min, Some(3));
///
/// let min = Stream::min_by(VecDeque::<usize>::new(), |x, y| x.cmp(y)).await;
/// assert_eq!(min, None);
/// #
/// # }) }
/// ```
fn min_by<F>(self, compare: F) -> MinBy<Self, F>
where
Self: Sized + Unpin,
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
{
MinBy::new(self, compare)
}

/// Tests if every element of the stream matches a predicate.
///
/// `all()` takes a closure that returns `true` or `false`. It applies
Expand Down

0 comments on commit 0d5f540

Please sign in to comment.