Skip to main content

ical/tree/prop/
concept.rs

1//! # CONCEPT lens
2//!
3//! The `CONCEPT` property lens.
4
5use crate::{
6    prop::IcalPropKind,
7    tree::{
8        line::IcalLine,
9        prop::{lens::IcalPropLens, spec::IcalPropSpec},
10        value::cursor::IcalValueCursor,
11    },
12    value::IcalValueKind,
13    value::uri::IcalUri,
14    version::IcalVersion,
15};
16
17/// The `CONCEPT` property lens.
18#[allow(non_camel_case_types)]
19pub struct CONCEPT;
20
21impl IcalPropLens for CONCEPT {
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 CONCEPT {
35    const KIND: IcalPropKind = IcalPropKind::Concept;
36
37    fn allowed_versions() -> &'static [IcalVersion] {
38        &[IcalVersion::V2_0]
39    }
40
41    fn allowed_values(_version: IcalVersion) -> &'static [IcalValueKind] {
42        &[IcalValueKind::Uri, IcalValueKind::Text]
43    }
44}