hummingly / ics

A Rust library for creating iCalendar files as specified in RFC5545 and RFC7986
Other
30 stars 3 forks source link

Parsing from a string to ICalendar #18

Open 13hannes11 opened 2 years ago

13hannes11 commented 2 years ago

I'd love to see the possibility to not only create but also parse ical files.

hummingly commented 2 years ago

At the moment I do not have as much time as I like. If you need parsing, the ical crate seems like a decent option, though.

That said what exactly would you imagine the API would be like? There are many variations to parsing. It could either be a separate Reader struct that contains all properties and components like in the ical crate, a FromStr implementation for ICalendar or an iterator over events.

13hannes11 commented 2 years ago

Not having enough time is ofc. understandable and I don't think this is a pressing matter however I would love to see a feature like that in this library.

Personally I would find a FromStr implementation the most useful. My thoughts behind that are that you could parse exist ics files or files that you created with the library so basically that the library allows you to do:

    let mut calendar = ICalendar::new("2.0", "-//xyz Corp//NONSGML PDA Calendar Version 1.0//EN");
(...)
    let ics_string = calendar.to_string()

    let calendar = ICalendar::from_string(ics_string);

However I am not that experienced with rust so there might be better options.