forked from mirror/async-std
run ignored test
This commit is contained in:
parent
6c8237276b
commit
c0f18600cf
3 changed files with 16 additions and 30 deletions
|
@ -1,7 +1,6 @@
|
||||||
use core::cmp::{Ord, Ordering};
|
use core::cmp::{Ord, Ordering};
|
||||||
use core::marker::PhantomData;
|
|
||||||
use core::pin::Pin;
|
|
||||||
use core::future::Future;
|
use core::future::Future;
|
||||||
|
use core::pin::Pin;
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
|
@ -11,29 +10,23 @@ use crate::task::{Context, Poll};
|
||||||
pin_project! {
|
pin_project! {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[allow(missing_debug_implementations)]
|
#[allow(missing_debug_implementations)]
|
||||||
pub struct MaxFuture<S, F, T> {
|
pub struct MaxFuture<S, T> {
|
||||||
#[pin]
|
#[pin]
|
||||||
stream: S,
|
stream: S,
|
||||||
_compare: PhantomData<F>,
|
|
||||||
max: Option<T>,
|
max: Option<T>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S, F, T> MaxFuture<S, F, T> {
|
impl<S, T> MaxFuture<S, T> {
|
||||||
pub(super) fn new(stream: S) -> Self {
|
pub(super) fn new(stream: S) -> Self {
|
||||||
Self {
|
Self { stream, max: None }
|
||||||
stream,
|
|
||||||
_compare: PhantomData,
|
|
||||||
max: None,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S, F> Future for MaxFuture<S, F, S::Item>
|
impl<S> Future for MaxFuture<S, S::Item>
|
||||||
where
|
where
|
||||||
S: Stream,
|
S: Stream,
|
||||||
S::Item: Ord,
|
S::Item: Ord,
|
||||||
F: FnMut(&S::Item, &S::Item) -> Ordering,
|
|
||||||
{
|
{
|
||||||
type Output = Option<S::Item>;
|
type Output = Option<S::Item>;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
use core::cmp::{Ord, Ordering};
|
use core::cmp::{Ord, Ordering};
|
||||||
use core::marker::PhantomData;
|
|
||||||
use core::pin::Pin;
|
|
||||||
use core::future::Future;
|
use core::future::Future;
|
||||||
|
use core::pin::Pin;
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
|
@ -11,29 +10,23 @@ use crate::task::{Context, Poll};
|
||||||
pin_project! {
|
pin_project! {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[allow(missing_debug_implementations)]
|
#[allow(missing_debug_implementations)]
|
||||||
pub struct MinFuture<S, F, T> {
|
pub struct MinFuture<S, T> {
|
||||||
#[pin]
|
#[pin]
|
||||||
stream: S,
|
stream: S,
|
||||||
_compare: PhantomData<F>,
|
|
||||||
min: Option<T>,
|
min: Option<T>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S, F, T> MinFuture<S, F, T> {
|
impl<S, T> MinFuture<S, T> {
|
||||||
pub(super) fn new(stream: S) -> Self {
|
pub(super) fn new(stream: S) -> Self {
|
||||||
Self {
|
Self { stream, min: None }
|
||||||
stream,
|
|
||||||
_compare: PhantomData,
|
|
||||||
min: None,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S, F> Future for MinFuture<S, F, S::Item>
|
impl<S> Future for MinFuture<S, S::Item>
|
||||||
where
|
where
|
||||||
S: Stream,
|
S: Stream,
|
||||||
S::Item: Ord,
|
S::Item: Ord,
|
||||||
F: FnMut(&S::Item, &S::Item) -> Ordering,
|
|
||||||
{
|
{
|
||||||
type Output = Option<S::Item>;
|
type Output = Option<S::Item>;
|
||||||
|
|
||||||
|
|
|
@ -1028,12 +1028,12 @@ extension_trait! {
|
||||||
# }) }
|
# }) }
|
||||||
```
|
```
|
||||||
"#]
|
"#]
|
||||||
fn max<F>(
|
fn max(
|
||||||
self,
|
self,
|
||||||
) -> impl Future<Output = Option<Self::Item>> [MaxFuture<Self, F, Self::Item>]
|
) -> impl Future<Output = Option<Self::Item>> [MaxFuture<Self, Self::Item>]
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
|
Self::Item: Ord,
|
||||||
{
|
{
|
||||||
MaxFuture::new(self)
|
MaxFuture::new(self)
|
||||||
}
|
}
|
||||||
|
@ -1061,12 +1061,12 @@ extension_trait! {
|
||||||
# }) }
|
# }) }
|
||||||
```
|
```
|
||||||
"#]
|
"#]
|
||||||
fn min<F>(
|
fn min(
|
||||||
self,
|
self,
|
||||||
) -> impl Future<Output = Option<Self::Item>> [MinFuture<Self, F, Self::Item>]
|
) -> impl Future<Output = Option<Self::Item>> [MinFuture<Self, Self::Item>]
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
|
Self::Item: Ord,
|
||||||
{
|
{
|
||||||
MinFuture::new(self)
|
MinFuture::new(self)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue