Pipeline: change the signature of pipeline to accept future::Stream instead of IntoIterator.

This commit is contained in:
Jordan Petridis 2018-04-18 04:05:14 +03:00
parent 418a2f02b2
commit 885c525d7b
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6

View File

@ -55,10 +55,9 @@ pub fn pipeline<'a, S>(
client: HttpsClient,
) -> Box<Future<Item = Vec<()>, Error = DataError> + 'a>
where
S: IntoIterator<Item = Source> + 'a,
S: Stream<Item = Source, Error = DataError> + 'a,
{
let stream = iter_ok::<_, DataError>(sources);
let pipeline = stream
let pipeline = sources
.and_then(clone!(client => move |s| s.into_feed(client.clone(), ignore_etags)))
.and_then(|feed| feed.index())
// the stream will stop at the first error so
@ -82,7 +81,8 @@ where
.connector(HttpsConnector::new(num_cpus::get(), &handle)?)
.build(&handle);
let p = pipeline(sources, ignore_etags, client);
let stream = iter_ok::<_, DataError>(sources);
let p = pipeline(stream, ignore_etags, client);
core.run(p).map(|_| ())
}