ical/parser/vcard/
component.rs1use std::cell::RefCell;
3use std::io::BufRead;
4
5#[cfg(feature = "serde-derive")]
6extern crate serde;
7
8use crate::parser::{Component, ParserError};
10use crate::property::{Property, PropertyParser};
11
12#[derive(Debug, Clone, Default)]
13#[cfg_attr(feature = "serde-derive", derive(serde::Serialize, serde::Deserialize))]
14pub struct VcardContact {
16 pub properties: Vec<Property>,
17}
18
19impl VcardContact {
20 pub fn new() -> VcardContact {
21 VcardContact {
22 properties: Vec::new(),
23 }
24 }
25}
26
27impl Component for VcardContact {
28 fn add_property(&mut self, property: Property) {
29 self.properties.push(property);
30 }
31
32 fn add_sub_component<B: BufRead>(
33 &mut self,
34 _: &str,
35 _: &RefCell<PropertyParser<B>>,
36 ) -> Result<(), ParserError> {
37 Err(ParserError::InvalidComponent.into())
38 }
39}