pub struct ICalendar(_);
Expand description
An ICalendar representing type
Implementations§
source§impl ICalendar
impl ICalendar
sourcepub fn build(s: &str) -> Result<ICalendar>
pub fn build(s: &str) -> Result<ICalendar>
Parse a string to a ICalendar object
Returns an error if the parsed text is not a ICalendar (that means that an error is returned also if this is a valid Vcard!)
pub fn empty() -> ICalendar
sourcepub fn add_event(&mut self, builder: EventBuilder)
pub fn add_event(&mut self, builder: EventBuilder)
Add an event to the calendar
sourcepub fn with_event(self, builder: EventBuilder) -> Self
pub fn with_event(self, builder: EventBuilder) -> Self
Chainable variant of ICalendar::add_event()
.
sourcepub fn from_component(c: Component) -> RResult<ICalendar, Component>
pub fn from_component(c: Component) -> RResult<ICalendar, Component>
Wrap a Component into a Vcard object, or don’t do it if the Component is not a Vcard.
sourcepub fn events<'a>(&'a self) -> EventIterator<'a> ⓘ
pub fn events<'a>(&'a self) -> EventIterator<'a> ⓘ
Get an iterator over the events in this calendar
The iterator creates Ok(&Event) instances on the fly, or Err(&Component) instances if the item cannot be parsed as an Event, not forgetting any data.
Getting actual objects
For getting a Event-instance iterator from this, one can use this as follows:
icalendar
.events()
.filter_map(Result::ok)
.map(|ev| ev.clone())
.collect::<Vec<Event>>();