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

            
6
derive_unplateable!(Metadata);
7

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

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