vcard/parameters/
sort_as.rs1use std::fmt::Display;
2
3use validators::{Validated, ValidatedWrapper};
4
5use super::{
6 super::values::{parameter_value::ParameterValues, Value},
7 *,
8};
9
10#[derive(Clone, Debug, PartialEq, Eq, Hash)]
11pub struct SortAs {
12 parameter_values: ParameterValues,
13}
14
15impl SortAs {
16 pub fn from_parameter_values(parameter_values: ParameterValues) -> SortAs {
17 SortAs {
18 parameter_values,
19 }
20 }
21
22 pub fn is_empty(&self) -> bool {
23 self.parameter_values.is_empty()
24 }
25}
26
27impl SortAs {
28 pub fn get_parameter_values(&self) -> &ParameterValues {
29 &self.parameter_values
30 }
31}
32
33impl Parameter for SortAs {
34 fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
35 f.write_str(";SORT-AS=")?;
36
37 Value::fmt(&self.parameter_values, f)?;
38
39 Ok(())
40 }
41}
42
43impl Display for SortAs {
44 fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
45 Parameter::fmt(self, f)
46 }
47}
48
49impl Validated for SortAs {}
50
51impl ValidatedWrapper for SortAs {
52 type Error = &'static str;
53
54 fn from_string(_from_string_input: String) -> Result<Self, Self::Error> {
55 unimplemented!();
56 }
57
58 fn from_str(_from_str_input: &str) -> Result<Self, Self::Error> {
59 unimplemented!();
60 }
61}