forked from mirror/async-std
update min_by_key doc
This commit is contained in:
parent
ca71ad073b
commit
080875edc9
1 changed files with 2 additions and 2 deletions
|
@ -875,10 +875,10 @@ extension_trait! {
|
|||
use async_std::prelude::*;
|
||||
use async_std::stream;
|
||||
|
||||
let s = stream::from_iter(vec![1isize, 2, -3]);
|
||||
let s = stream::from_iter(vec![-1isize, 2, -3]);
|
||||
|
||||
let min = s.clone().min_by_key(|x| x.abs()).await;
|
||||
assert_eq!(min, Some(1));
|
||||
assert_eq!(min, Some(-1));
|
||||
|
||||
let min = stream::empty::<isize>().min_by_key(|x| x.abs()).await;
|
||||
assert_eq!(min, None);
|
||||
|
|
Loading…
Reference in a new issue