use crate::{
param::VcardParamKind,
prop::VcardPropKind,
tree::{
line::VcardLine,
prop::{lens::VcardPropLens, spec::VcardPropSpec},
value::cursor::VcardValueCursor,
},
value::{VcardValueKind, text::VcardTextList},
version::VcardVersion,
};
pub struct CATEGORIES;
impl VcardPropLens for CATEGORIES {
type Target<'v> = VcardTextList<'v>;
type Cursor<'c, 'a>
= VcardValueCursor<'c, 'a>
where
'a: 'c;
fn cursor<'c, 'a>(line: &'c mut VcardLine<'a>) -> VcardValueCursor<'c, 'a> {
VcardValueCursor { line }
}
}
impl VcardPropSpec for CATEGORIES {
const KIND: VcardPropKind = VcardPropKind::Categories;
fn allowed_versions() -> &'static [VcardVersion] {
&[VcardVersion::V3_0, VcardVersion::V4_0]
}
fn allowed_values(_version: VcardVersion) -> &'static [VcardValueKind] {
&[VcardValueKind::TextList]
}
fn allowed_params(_version: VcardVersion) -> &'static [VcardParamKind] {
&[
VcardParamKind::Pid,
VcardParamKind::Pref,
VcardParamKind::Type,
VcardParamKind::AltId,
VcardParamKind::Value,
]
}
}