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
12
#[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
2920
    pub fn new() -> Metadata {
16
2920
        Metadata {
17
2920
            clean: false,
18
2920
            etype: None,
19
2920
        }
20
2920
    }
21

            
22
    pub fn clone_dirty(&self) -> Metadata {
23
        Metadata {
24
            clean: false,
25
            ..self.clone()
26
        }
27
    }
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
// }