rs_teststand/expression/function/
property.rs1#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
7pub enum PropertyFunction {
8 CommentOf,
10 FindStep,
12 NameOf,
14 PropertyExists,
16 TypeOf,
18}
19
20impl PropertyFunction {
21 pub const ALL: [Self; 5] = [
23 Self::CommentOf,
24 Self::FindStep,
25 Self::NameOf,
26 Self::PropertyExists,
27 Self::TypeOf,
28 ];
29
30 #[must_use]
32 pub const fn name(self) -> &'static str {
33 match self {
34 Self::CommentOf => "CommentOf",
35 Self::FindStep => "FindStep",
36 Self::NameOf => "NameOf",
37 Self::PropertyExists => "PropertyExists",
38 Self::TypeOf => "TypeOf",
39 }
40 }
41}
42
43#[cfg(test)]
44mod tests {
45 use super::PropertyFunction;
46
47 #[test]
48 fn every_name_is_distinct() {
49 let mut names: Vec<&str> = PropertyFunction::ALL.iter().map(|f| f.name()).collect();
50 names.sort_unstable();
51 let count = names.len();
52 names.dedup();
53 assert_eq!(names.len(), count);
54 }
55}