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