use crate::ir;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum FileMode {
Text,
Binary,
Executable,
}
#[derive(Debug, Clone, PartialEq)]
pub struct OutputFile {
pub path: String,
pub content: Vec<u8>,
pub mode: FileMode,
}
impl OutputFile {
pub fn text(path: impl Into<String>, content: impl Into<String>) -> Self {
Self {
path: path.into(),
content: content.into().into_bytes(),
mode: FileMode::Text,
}
}
pub fn binary(path: impl Into<String>, content: impl Into<Vec<u8>>) -> Self {
Self {
path: path.into(),
content: content.into(),
mode: FileMode::Binary,
}
}
pub fn executable(path: impl Into<String>, content: impl Into<Vec<u8>>) -> Self {
Self {
path: path.into(),
content: content.into(),
mode: FileMode::Executable,
}
}
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct GenerationOutput {
pub files: Vec<OutputFile>,
pub diagnostics: Vec<ir::Diagnostic>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct TransformOutput {
pub spec: ir::Ir,
pub diagnostics: Vec<ir::Diagnostic>,
}