Skip to content
This repository has been archived by the owner on Aug 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #29 from jbg/master
Browse files Browse the repository at this point in the history
Merge @jbg fork into the main flow
  • Loading branch information
Peltoche authored Oct 28, 2018
2 parents 7d2199a + 09e2c25 commit e1645bb
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion src/parser/ical/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,12 @@ impl Component for IcalTodo {
#[derive(Debug, Clone, Default)]
pub struct IcalTimeZone {
pub properties: Vec<Property>,
pub transitions: Vec<IcalTimeZoneTransition>,
}

impl IcalTimeZone {
pub fn new() -> IcalTimeZone {
IcalTimeZone { properties: Vec::new() }
IcalTimeZone { properties: Vec::new(), transitions: Vec::new() }
}
}

Expand All @@ -231,6 +232,40 @@ impl Component for IcalTimeZone {
self.properties.push(property);
}

fn add_sub_component<B: BufRead>(&mut self,
value: &str,
line_parser: &RefCell<PropertyParser<B>>)
-> Result<()> {
match value {
"STANDARD" | "DAYLIGHT" => {
let mut transition = IcalTimeZoneTransition::new();
transition.parse(line_parser)?;
self.transitions.push(transition);
}
_ => return Err(ErrorKind::InvalidComponent.into())
};

Ok(())
}
}


#[derive(Debug, Clone, Default)]
pub struct IcalTimeZoneTransition {
pub properties: Vec<Property>,
}

impl IcalTimeZoneTransition {
pub fn new() -> IcalTimeZoneTransition {
IcalTimeZoneTransition { properties: Vec::new() }
}
}

impl Component for IcalTimeZoneTransition {
fn add_property(&mut self, property: Property) {
self.properties.push(property);
}

fn add_sub_component<B: BufRead>(&mut self,
_: &str,
_: &RefCell<PropertyParser<B>>)
Expand Down

0 comments on commit e1645bb

Please sign in to comment.