gesha_rust_types/
derive_attribute.rs

1use std::borrow::Borrow;
2use std::fmt::{Display, Formatter};
3
4#[derive(Clone, Debug, Hash, Eq, PartialEq)]
5pub enum DeriveAttribute {
6    Clone,
7    Debug,
8    Deserialize,
9    PartialEq,
10    Serialize,
11}
12
13impl DeriveAttribute {
14    pub fn all() -> Vec<Self> {
15        vec![
16            Self::Clone,
17            Self::Debug,
18            Self::Deserialize,
19            Self::PartialEq,
20            Self::Serialize,
21        ]
22    }
23}
24
25impl Borrow<str> for DeriveAttribute {
26    fn borrow(&self) -> &str {
27        match self {
28            Self::Clone => "Clone",
29            Self::Debug => "Debug",
30            Self::Deserialize => "Deserialize",
31            Self::PartialEq => "PartialEq",
32            Self::Serialize => "Serialize",
33        }
34    }
35}
36
37impl Display for DeriveAttribute {
38    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
39        let x: &str = Borrow::borrow(self);
40        Display::fmt(x, f)
41    }
42}