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 URL;
20
21impl IcalPropLens for URL {
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 URL {
35 const KIND: IcalPropKind = IcalPropKind::Url;
36
37 fn cardinality(_version: IcalVersion) -> IcalPropCardinality {
38 IcalPropCardinality::AtMostOne
39 }
40
41 fn allowed_values(_version: IcalVersion) -> &'static [IcalValueKind] {
42 &[IcalValueKind::Uri]
43 }
44}