• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lennart-k / ical-rs / #68

12 Jan 2026 10:17AM UTC coverage: 80.485% (+2.7%) from 77.802%
#68

Pull #2

lennart-k
fixes
Pull Request #2: Major overhaul

935 of 1181 new or added lines in 30 files covered. (79.17%)

21 existing lines in 9 files now uncovered.

1262 of 1568 relevant lines covered (80.48%)

2.85 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.82
/src/parser/vcard/component.rs
1
use crate::parser::{
2
    Component, ComponentMut, GetProperty, IcalUIDProperty, ParserError, VcardANNIVERSARYProperty,
3
    VcardBDAYProperty, VcardFNProperty, VcardNProperty,
4
};
5
use crate::property::{ContentLine, PropertyParser};
6
use std::collections::HashMap;
7
use std::io::BufRead;
8

9
#[derive(Debug, Clone)]
10
pub struct VcardContact {
11
    pub uid: Option<String>,
12
    pub full_name: Vec<VcardFNProperty>,
13
    pub name: Option<VcardNProperty>,
14
    pub birthday: Option<VcardBDAYProperty>,
15
    pub anniversary: Option<VcardANNIVERSARYProperty>,
16
    pub properties: Vec<ContentLine>,
17
}
18

19
#[derive(Debug, Clone, Default)]
20
pub struct VcardContactBuilder {
21
    pub properties: Vec<ContentLine>,
22
}
23

24
impl VcardContact {
UNCOV
25
    pub fn get_uid(&self) -> Option<&str> {
×
NEW
26
        self.uid.as_deref()
×
27
    }
28
}
29

30
impl Component for VcardContactBuilder {
31
    const NAMES: &[&str] = &["VCARD"];
32
    type Unverified = VcardContactBuilder;
33

34
    fn get_properties(&self) -> &Vec<ContentLine> {
1✔
35
        &self.properties
36
    }
37

UNCOV
38
    fn mutable(self) -> Self::Unverified {
×
NEW
39
        self
×
40
    }
41
}
42

43
impl Component for VcardContact {
44
    const NAMES: &[&str] = &["VCARD"];
45
    type Unverified = VcardContactBuilder;
46

47
    fn get_properties(&self) -> &Vec<ContentLine> {
1✔
48
        &self.properties
1✔
49
    }
50

51
    fn mutable(self) -> Self::Unverified {
1✔
52
        VcardContactBuilder {
53
            properties: self.properties,
1✔
54
        }
55
    }
56
}
57

58
impl ComponentMut for VcardContactBuilder {
59
    type Verified = VcardContact;
60

61
    fn get_properties_mut(&mut self) -> &mut Vec<ContentLine> {
2✔
62
        &mut self.properties
63
    }
64

65
    fn add_sub_component<B: BufRead>(
1✔
66
        &mut self,
67
        name: &str,
68
        _: &mut PropertyParser<B>,
69
    ) -> Result<(), ParserError> {
70
        Err(ParserError::InvalidComponent(name.to_owned()))
1✔
71
    }
72

73
    fn build(
1✔
74
        self,
75
        timezones: Option<&HashMap<String, Option<chrono_tz::Tz>>>,
76
    ) -> Result<Self::Verified, ParserError> {
77
        let uid = self
2✔
78
            .safe_get_optional(timezones)?
1✔
79
            .map(|IcalUIDProperty(uid, _)| uid);
2✔
80

81
        let name = self.safe_get_optional(timezones)?;
4✔
82
        let full_name = self.safe_get_all(timezones)?;
4✔
83
        let birthday = self.safe_get_optional(timezones)?;
3✔
84
        let anniversary = self.safe_get_optional(timezones)?;
2✔
85

86
        let verified = VcardContact {
87
            uid,
88
            name,
89
            full_name,
90
            birthday,
91
            anniversary,
92
            properties: self.properties,
1✔
93
        };
94

95
        Ok(verified)
1✔
96
    }
97
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc