These are chat archives for rust-lang/rust

7th
Jul 2017
stevensonmt
@stevensonmt
Jul 07 2017 17:34
If I want to use the ical-rs crate for parsing a .ics file, but the file is at a URI like http://www.opm.gov/about-us/open-government/Data/Apps/Holidays/holidays.ical do I need to first use something like hyper to GET the file and then use the ical functions to parse the data?
Jonas Platte
@jplatte
Jul 07 2017 17:44
@stevensonmt If all you want to do is download the file, reqwest is probably a better choice than hyper, but yeah, if you want your program to download the file rather than read it from your disk after you've already downloaded it, you'll need to use some sort of http library for that.
I guess some parser crates, e.g. for xml where referencing other documents via url is a thing might also give you the option of just providing the url and they then use some http client library internally, but that doesn't seem to be the case for ical-rs
stevensonmt
@stevensonmt
Jul 07 2017 17:46
nice, thanks for the tip on reqwest. Looks like just what I need.
Jonas Platte
@jplatte
Jul 07 2017 17:46
surprisingly enough, it only has a single dependency, error-chain
I wonder if there's just something about ical that makes it less desirable to write a parser for it with a parser combinator, or if parser combinators are just not as universal as I thought, or if the author had some other reason to do the parsing manually.
stevensonmt
@stevensonmt
Jul 07 2017 18:12
Not sure though it does say he intended it to be a port of a JS library, so perhaps that is why.