Skip to main content

ical/prop/
duration.rs

1//! # DURATION
2//!
3//! The `DURATION` property: how long the component lasts, an alternative to
4//! `DTEND` (RFC 5545 3.8.2.5).
5
6use crate::{
7    prop::{IcalPropKind, cardinality::IcalPropCardinality, spec::IcalPropSpec},
8    value::IcalValueKind,
9    version::IcalVersion,
10};
11
12/// The `DURATION` property marker.
13pub struct DURATION;
14
15impl IcalPropSpec for DURATION {
16    const KIND: IcalPropKind = IcalPropKind::Duration;
17
18    fn allowed_versions() -> &'static [IcalVersion] {
19        &[IcalVersion::V2_0]
20    }
21
22    fn cardinality(_version: IcalVersion) -> IcalPropCardinality {
23        IcalPropCardinality::AtMostOne
24    }
25
26    fn allowed_values(_version: IcalVersion) -> &'static [IcalValueKind] {
27        &[IcalValueKind::Duration]
28    }
29}