|
|
@ -911,10 +911,10 @@ extension_trait! {
|
|
|
|
use async_std::prelude::*;
|
|
|
|
use async_std::prelude::*;
|
|
|
|
use async_std::stream;
|
|
|
|
use async_std::stream;
|
|
|
|
|
|
|
|
|
|
|
|
let s = stream::from_iter(vec![-1isize, -2, -3]);
|
|
|
|
let s = stream::from_iter(vec![-3_i32, 0, 1, 5, -10]);
|
|
|
|
|
|
|
|
|
|
|
|
let max = s.clone().max_by_key(|x| x.abs()).await;
|
|
|
|
let max = s.clone().max_by_key(|x| x.abs()).await;
|
|
|
|
assert_eq!(max, Some(3));
|
|
|
|
assert_eq!(max, Some(-10));
|
|
|
|
|
|
|
|
|
|
|
|
let max = stream::empty::<isize>().max_by_key(|x| x.abs()).await;
|
|
|
|
let max = stream::empty::<isize>().max_by_key(|x| x.abs()).await;
|
|
|
|
assert_eq!(max, None);
|
|
|
|
assert_eq!(max, None);
|
|
|
|