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

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