donet_core/dcstruct.rs
1/*
2 This file is part of Donet.
3
4 Copyright © 2024 Max Rodriguez <[email protected]>
5
6 Donet is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Affero General Public License,
8 as published by the Free Software Foundation, either version 3
9 of the License, or (at your option) any later version.
10
11 Donet is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Affero General Public License for more details.
15
16 You should have received a copy of the GNU Affero General Public
17 License along with Donet. If not, see <https://www.gnu.org/licenses/>.
18*/
19
20//! Data model representing a DC Struct element. [NEEDS WORK]
21
22use crate::dcfile::DCFile;
23use crate::dconfig::*;
24use crate::hashgen::*;
25
26#[derive(Debug, Clone)]
27pub struct DCStruct<'dc> {
28 dcfile: &'dc DCFile<'dc>,
29}
30
31impl std::fmt::Display for DCStruct<'_> {
32 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
33 writeln!(f, "TODO")
34 }
35}
36
37impl DCFileConfigAccessor for DCStruct<'_> {
38 fn get_dc_config(&self) -> &DCFileConfig {
39 self.dcfile.get_dc_config()
40 }
41}
42
43impl LegacyDCHash for DCStruct<'_> {
44 fn generate_hash(&self, _: &mut DCHashGenerator) {
45 // TODO
46 }
47}
48
49/// Contains intermediate DC struct element structure and logic
50/// for semantic analysis as the DC struct is being built.
51pub(crate) mod interim {
52 #[derive(Debug)]
53 pub struct DCStruct {}
54}