1
use crate::ast::types::ReturnType;
2
use serde::{Deserialize, Serialize};
3
use std::fmt::{Debug, Display};
4
use uniplate::{derive_unplateable, Biplate, Uniplate};
5

            
6
derive_unplateable!(Metadata);
7

            
8
8232
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize, Default)]
9
pub struct Metadata {
10
    pub clean: bool,
11
    pub etype: Option<ReturnType>,
12
}
13

            
14
impl Metadata {
15
2637087
    pub fn new() -> Metadata {
16
2637087
        Metadata {
17
2637087
            clean: false,
18
2637087
            etype: None,
19
2637087
        }
20
2637087
    }
21

            
22
24259
    pub fn clone_dirty(&self) -> Metadata {
23
24259
        Metadata {
24
24259
            clean: false,
25
24259
            ..self.clone()
26
24259
        }
27
24259
    }
28
}
29

            
30
impl Display for Metadata {
31
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
32
        write!(f, "Metadata")
33
    }
34
}
35

            
36
// impl<T> Display for Metadata<T> where T: for<'a> MetadataKind<'a> {
37
//     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
38
//         write!(f, "Metadata")
39
//     }
40
// }
41

            
42
//
43
// impl<T> Metadata<T> where T: for<'a> MetadataKind<'a> {
44
//     fn new(a: T) -> Metadata<T> {
45
//         Metadata { a }
46
//     }
47
// }