conjure_cp_core/ast/
metadata.rs1use crate::ast::ReturnType;
2use polyquine::Quine;
3use serde::{Deserialize, Serialize};
4use std::fmt::{Debug, Display};
5use std::hash::Hash;
6use uniplate::derive_unplateable;
7
8derive_unplateable!(Metadata);
9
10#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize, Default, Quine)]
11#[path_prefix(conjure_cp::ast)]
12pub struct Metadata {
13 pub clean: bool,
14 pub etype: Option<ReturnType>,
15}
16
17impl Metadata {
18 pub fn new() -> Metadata {
19 Metadata {
20 clean: false,
21 etype: None,
22 }
23 }
24
25 pub fn clone_dirty(&self) -> Metadata {
26 Metadata {
27 clean: false,
28 ..self.clone()
29 }
30 }
31}
32
33impl Display for Metadata {
34 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
35 write!(f, "Metadata")
36 }
37}
38
39impl Hash for Metadata {
40 fn hash<H: std::hash::Hasher>(&self, _state: &mut H) {
41 }
43}