microcad_lang/model/
creator.rs1use crate::{symbol::Symbol, value::Tuple};
7
8#[derive(Debug, Clone)]
10pub struct Creator {
11 pub symbol: Symbol,
13 pub arguments: Tuple,
15}
16
17impl Creator {
18 pub fn new(symbol: Symbol, arguments: Tuple) -> Self {
20 Self { symbol, arguments }
21 }
22}
23
24impl std::fmt::Display for Creator {
25 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
26 write!(
27 f,
28 "{symbol}{arguments}",
29 symbol = self.symbol.full_name(),
30 arguments = self.arguments
31 )
32 }
33}
34
35impl std::hash::Hash for Creator {
36 fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
37 self.symbol.full_name().hash(state);
38 self.arguments.hash(state);
39 }
40}