thot_core/system/
script.rs

1use crate::types::ResourceId;
2use std::collections::HashSet;
3use std::path::PathBuf;
4
5#[cfg(feature = "serde")]
6use serde::{Deserialize, Serialize};
7
8// **************
9// *** Script ***
10// **************
11
12/// Represents a Script.
13///
14/// # Fields
15/// + **projects:** The projects the script is used in.
16#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
17#[derive(Debug)]
18pub struct Script {
19    pub rid: ResourceId,
20    pub path: PathBuf,
21    pub name: Option<String>,
22    pub description: Option<String>,
23    pub projects: HashSet<ResourceId>,
24}
25
26impl Script {
27    pub fn new(path: PathBuf) -> Script {
28        let rid = ResourceId::new();
29        Script {
30            rid,
31            path,
32            name: None,
33            description: None,
34            projects: HashSet::new(),
35        }
36    }
37}
38
39#[cfg(test)]
40#[path = "./script_test.rs"]
41mod script_test;