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

lennart-k / ical-rs / #73

12 Jan 2026 01:50PM UTC coverage: 77.771% (-0.03%) from 77.802%
#73

Pull #2

lennart-k
IcalCalendarObjectBuilder: Make attributes public
Pull Request #2: Major overhaul

908 of 1184 new or added lines in 30 files covered. (76.69%)

32 existing lines in 10 files now uncovered.

1221 of 1570 relevant lines covered (77.77%)

2.77 hits per line

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

72.73
/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> {
2✔
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

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

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

61
    fn get_properties_mut(&mut self) -> &mut Vec<ContentLine> {
1✔
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