From 61eccba17320dafe55f16180e6f94a5f2315fc69 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 11 Mar 2018 14:53:08 -0700 Subject: [PATCH] Starting to improve infrastrucutre for lang output To make repl vs non-repl output better --- schala-lib/src/language.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/schala-lib/src/language.rs b/schala-lib/src/language.rs index 06e36c3..6e84f03 100644 --- a/schala-lib/src/language.rs +++ b/schala-lib/src/language.rs @@ -1,5 +1,6 @@ extern crate colored; +use std::collections::HashMap; use self::colored::*; pub struct LLVMCodeString(pub String); @@ -51,6 +52,29 @@ impl LanguageOutput { } } +#[derive(Debug, Default)] +pub struct UnfinishedComputation { + artifacts: HashMap, +} + +#[derive(Debug)] +pub struct FinishedComputation { + artifacts: HashMap, + text_output: Result, +} + +impl UnfinishedComputation { + pub fn add_artifact(&mut self, artifact: TraceArtifact) { + self.artifacts.insert(artifact.stage_name.clone(), artifact); + } + pub fn output(self, output: Result) -> FinishedComputation { + FinishedComputation { + artifacts: self.artifacts, + text_output: output + } + } +} + /* //TODO I'll probably wanna implement this later #[derive(Debug)]