thot_core/db/resources/
container.rs1use super::object::{Object, StandardObject};
3use super::standard_properties::StandardProperties;
4use crate::types::ResourceId;
5use std::collections::HashSet;
6use std::hash::{Hash, Hasher};
7
8#[cfg(feature = "serde")]
9use serde::Deserialize;
10
11#[cfg_attr(feature = "pyo3", pyo3::pyclass)]
17#[cfg_attr(feature = "serde", derive(Deserialize))]
18#[derive(Clone, PartialEq, Eq, Debug)]
19pub struct Container {
20 pub properties: StandardProperties,
21 pub children: HashSet<ResourceId>,
22 pub assets: HashSet<ResourceId>,
23
24 #[cfg_attr(feature = "serde", serde(skip))]
25 pub parent: Option<ResourceId>,
26}
27
28impl Container {}
29
30impl Hash for Container {
31 fn hash<H: Hasher>(&self, state: &mut H) {
32 self.properties.hash(state);
33 }
34}
35
36impl Object for Container {}
37
38impl StandardObject for Container {
39 fn properties(&self) -> &StandardProperties {
40 &self.properties
41 }
42
43 fn properties_mut(&mut self) -> &mut StandardProperties {
44 &mut self.properties
45 }
46}
47
48#[cfg(test)]
49#[path = "./container_test.rs"]
50mod container_test;