Skip to content

Commit 0d5f540

Browse files
author
Stjepan Glavina
authored
Revert "add stream::min_by method (#146)"
This reverts commit 7e3599a.
1 parent 5d73776 commit 0d5f540

File tree

3 files changed

+0
-90
lines changed

3 files changed

+0
-90
lines changed

src/stream/min_by.rs

-54
This file was deleted.

src/stream/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ pub use repeat::{repeat, Repeat};
2727
pub use stream::{Stream, Take};
2828

2929
mod empty;
30-
mod min_by;
3130
mod once;
3231
mod repeat;
3332
mod stream;

src/stream/stream.rs

-35
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@
2121
//! # }) }
2222
//! ```
2323
24-
use std::cmp::Ordering;
2524
use std::pin::Pin;
2625

2726
use cfg_if::cfg_if;
2827

29-
use super::min_by::MinBy;
3028
use crate::future::Future;
3129
use crate::task::{Context, Poll};
3230
use std::marker::PhantomData;
@@ -120,39 +118,6 @@ pub trait Stream {
120118
}
121119
}
122120

123-
/// Returns the element that gives the minimum value with respect to the
124-
/// specified comparison function. If several elements are equally minimum,
125-
/// the first element is returned. If the stream is empty, `None` is returned.
126-
///
127-
/// # Examples
128-
///
129-
/// ```
130-
/// # fn main() { async_std::task::block_on(async {
131-
/// #
132-
/// use std::collections::VecDeque;
133-
/// use async_std::stream::Stream;
134-
///
135-
/// let s: VecDeque<usize> = vec![1, 2, 3].into_iter().collect();
136-
///
137-
/// let min = Stream::min_by(s.clone(), |x, y| x.cmp(y)).await;
138-
/// assert_eq!(min, Some(1));
139-
///
140-
/// let min = Stream::min_by(s, |x, y| y.cmp(x)).await;
141-
/// assert_eq!(min, Some(3));
142-
///
143-
/// let min = Stream::min_by(VecDeque::<usize>::new(), |x, y| x.cmp(y)).await;
144-
/// assert_eq!(min, None);
145-
/// #
146-
/// # }) }
147-
/// ```
148-
fn min_by<F>(self, compare: F) -> MinBy<Self, F>
149-
where
150-
Self: Sized + Unpin,
151-
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
152-
{
153-
MinBy::new(self, compare)
154-
}
155-
156121
/// Tests if every element of the stream matches a predicate.
157122
///
158123
/// `all()` takes a closure that returns `true` or `false`. It applies

0 commit comments

Comments
 (0)