#[cfg(test)]
mod tests {
use super::*;
use tokio;
use tokio::time::interval;
#[test]
fn test_prio_retry() {
let mut items = vec![0, 1, 2, 3, 3, 3, 0, 1, 2, 2, 6, 5, 7].into_iter();
let len = items.len();
let items = interval(Duration::from_millis(200))
.take(len as usize)
.map(move |_| items.next().unwrap())
.map_err(|e| error!("can't consume interval: {:?}", e));
let exp: Vec<i64> = vec![0, 1, 2, 3, 3, 3, 6, 7];
let stream = PrioRetry::new(items, Duration::from_millis(100));
let res = stream.collect();
tokio::run(res.then(move |res| {
match res {
Err(_) => assert!(false),
Ok(items) => assert_eq!(items, exp, "can't get expected items from prio retry"),
};
Ok(())
}));
}
}
reqwest = { version = "0.10", features = ["blocking","json"] }
tokio = { version = "0.2", features = ["full"] }
it throws out some errors
no method named `map_err` found for struct `futures_util::stream::stream::map::Map<futures_util::stream::stream::take::Take<tokio::time::interval::Interval>, [closure@src/future/prio_retry.rs:151:18: 151:48 items:_]>` in the current scope
cannot find function `run` in crate `tokio`
no method named `then` found for struct `futures_util::stream::stream::collect::Collect<future::prio_retry::PrioRetry<_>, _>` in the current scope
can someone help me ?