Skip to main content

ical/tree/prop/
uid.rs

1//! # UID lens
2//!
3//! The `UID` property lens.
4
5use crate::{
6    prop::IcalPropKind,
7    tree::{
8        line::IcalLine,
9        prop::{cardinality::IcalPropCardinality, lens::IcalPropLens, spec::IcalPropSpec},
10        value::cursor::IcalValueCursor,
11    },
12    value::text::IcalText,
13    version::IcalVersion,
14};
15
16/// The `UID` property lens.
17#[allow(non_camel_case_types)]
18pub struct UID;
19
20impl IcalPropLens for UID {
21    type Target<'v> = IcalText<'v>;
22
23    type Cursor<'c, 'a>
24        = IcalValueCursor<'c, 'a>
25    where
26        'a: 'c;
27
28    fn cursor<'c, 'a>(line: &'c mut IcalLine<'a>) -> IcalValueCursor<'c, 'a> {
29        IcalValueCursor { line }
30    }
31}
32
33impl IcalPropSpec for UID {
34    const KIND: IcalPropKind = IcalPropKind::Uid;
35
36    fn cardinality(_version: IcalVersion) -> IcalPropCardinality {
37        IcalPropCardinality::AtMostOne
38    }
39}