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