1use crate::{
6 prop::IcalPropKind,
7 tree::{
8 line::IcalLine,
9 prop::{IcalPropCardinality, IcalPropLens, IcalPropSpec},
10 value::IcalValueCursor,
11 },
12 value::IcalValueKind,
13 value::uri::IcalUri,
14 version::IcalVersion,
15};
16
17#[allow(non_camel_case_types)]
19pub struct SOURCE;
20
21impl IcalPropLens for SOURCE {
22 type Target<'v> = IcalUri<'v>;
23
24 type Cursor<'c, 'a>
25 = IcalValueCursor<'c, 'a>
26 where
27 'a: 'c;
28
29 fn cursor<'c, 'a>(line: &'c mut IcalLine<'a>) -> IcalValueCursor<'c, 'a> {
30 IcalValueCursor { line }
31 }
32}
33
34impl IcalPropSpec for SOURCE {
35 const KIND: IcalPropKind = IcalPropKind::Source;
36
37 fn allowed_versions() -> &'static [IcalVersion] {
38 &[IcalVersion::V2_0]
39 }
40
41 fn cardinality(_version: IcalVersion) -> IcalPropCardinality {
42 IcalPropCardinality::AtMostOne
43 }
44
45 fn allowed_values(_version: IcalVersion) -> &'static [IcalValueKind] {
46 &[IcalValueKind::Uri]
47 }
48}