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

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