nmd_core/compilation/
compilation_outcome.rs

1use getset::{Getters, MutGetters, Setters};
2use serde::{Deserialize, Serialize};
3
4use crate::compilable_text::CompilableText;
5
6
7
8#[derive(Debug, Getters, MutGetters, Setters, Serialize, Deserialize)]
9pub struct CompilationOutcome {
10
11    #[getset(get="pub", get_mut="pub")]
12    content: String
13}
14
15impl CompilationOutcome {
16    pub fn empty() -> Self {
17        Self {
18            content: String::new()
19        }
20    }
21}
22
23impl From<String> for CompilationOutcome {
24    fn from(content: String) -> Self {
25        Self {
26            content
27        }
28    }
29}
30
31
32impl From<&str> for CompilationOutcome {
33    fn from(content: &str) -> Self {
34        Self::from(content.to_string())
35    }
36}
37
38impl From<&CompilableText> for CompilationOutcome {
39    fn from(value: &CompilableText) -> Self {
40        Self::from(value.content())
41    }
42}