thot_core/runner/resources/
container.rs

1use super::script_association::ScriptAssociation;
2use crate::types::ResourceId;
3use std::collections::HashSet;
4use std::hash::{Hash, Hasher};
5
6// *****************
7// *** Container ***
8// *****************
9
10/// A Container utilized by a `Runner`.
11#[derive(PartialEq, Eq)]
12pub struct Container {
13    pub properties: ContainerProperties,
14    pub children: HashSet<Container>,
15}
16
17impl Hash for Container {
18    fn hash<H: Hasher>(&self, state: &mut H) {
19        self.properties.hash(state);
20    }
21}
22
23// ******************
24// *** Properties ***
25// ******************
26
27/// Container properties.
28#[derive(PartialEq, Eq)]
29pub struct ContainerProperties {
30    pub rid: ResourceId,
31    pub scripts: HashSet<ScriptAssociation>,
32}
33
34impl Hash for ContainerProperties {
35    fn hash<H: Hasher>(&self, state: &mut H) {
36        self.rid.hash(state);
37    }
38}
39
40#[cfg(test)]
41#[path = "./container_test.rs"]
42mod container_test;