vcard/values/
key_value.rs1use std::fmt::Display;
2
3use validators::{Validated, ValidatedWrapper};
4
5use super::{text::Text, uri::URI, *};
6
7#[derive(Clone, Debug, PartialEq, Eq, Hash)]
8#[allow(clippy::upper_case_acronyms)]
9pub enum KeyValue {
10 URI(URI),
11 Text(Text),
12}
13
14impl Value for KeyValue {
15 fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
16 match self {
17 KeyValue::URI(uri) => {
18 Value::fmt(uri, f)?;
19 },
20 KeyValue::Text(text) => {
21 Value::fmt(text, f)?;
22 },
23 }
24
25 Ok(())
26 }
27}
28
29impl Display for KeyValue {
30 fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
31 Value::fmt(self, f)
32 }
33}
34
35impl Validated for KeyValue {}
36
37impl ValidatedWrapper for KeyValue {
38 type Error = &'static str;
39
40 fn from_string(_from_string_input: String) -> Result<Self, Self::Error> {
41 unimplemented!();
42 }
43
44 fn from_str(_from_str_input: &str) -> Result<Self, Self::Error> {
45 unimplemented!();
46 }
47}