abs_data/models/typed/
reference.rs1use std::fmt::{self, Display, Formatter};
2
3use super::structure_type::StructureType;
4
5use serde::{Deserialize, Serialize};
6use strum_macros::EnumIter;
7
8#[derive(
9 Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, EnumIter,
10)]
11pub enum Reference {
12 None,
13 Parents,
14 ParentsAndSimplings,
15 Children,
16 Descendants,
17 All,
18 StructureType(StructureType),
19}
20
21impl<'a> Display for Reference {
22 fn fmt(&self, f: &mut Formatter) -> fmt::Result {
23 match self {
24 Self::None => write!(f, "none"),
25 Self::Parents => write!(f, "parents"),
26 Self::ParentsAndSimplings => write!(f, "parentsandsiblings"),
27 Self::Children => write!(f, "children"),
28 Self::Descendants => write!(f, "descendants"),
29 Self::All => write!(f, "all"),
30 Self::StructureType(structure_type) => write!(f, "{}", structure_type),
31 }
32 }
33}