nmd_core/compilation/
compilation_outcome.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use getset::{Getters, MutGetters, Setters};
use serde::{Deserialize, Serialize};

use crate::compilable_text::CompilableText;



#[derive(Debug, Getters, MutGetters, Setters, Serialize, Deserialize)]
pub struct CompilationOutcome {

    #[getset(get="pub", get_mut="pub")]
    content: String
}

impl CompilationOutcome {
    pub fn empty() -> Self {
        Self {
            content: String::new()
        }
    }
}

impl From<String> for CompilationOutcome {
    fn from(content: String) -> Self {
        Self {
            content
        }
    }
}


impl From<&str> for CompilationOutcome {
    fn from(content: &str) -> Self {
        Self::from(content.to_string())
    }
}

impl From<&CompilableText> for CompilationOutcome {
    fn from(value: &CompilableText) -> Self {
        Self::from(value.content())
    }
}