opml: Change the signature of import_opml function.

xml::reader::Error is the only error that can be returned so there
is no need to use the DataError type.
This commit is contained in:
Jordan Petridis 2018-05-12 13:19:14 +03:00
parent ab4f958b5f
commit 6e5c70ab71
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6

View File

@ -25,12 +25,13 @@ pub struct Opml {
} }
/// Import feed url's from a `R` into the `Source` table. /// Import feed url's from a `R` into the `Source` table.
pub fn opml_import<R: Read>(reader: R) -> Result<Vec<Result<Source, DataError>>, DataError> { pub fn opml_import<R: Read>(reader: R) -> Result<Vec<Result<Source, DataError>>, reader::Error> {
let feeds = extract_sources(reader)?; let feeds = extract_sources(reader)?
Ok(feeds
.iter() .iter()
.map(|opml| Source::from_url(&opml.url)) .map(|opml| Source::from_url(&opml.url))
.collect()) .collect();
Ok(feeds)
} }
/// Extracts the `outline` elemnts from a reader `R` and returns a `HashSet` of `Opml` structs. /// Extracts the `outline` elemnts from a reader `R` and returns a `HashSet` of `Opml` structs.