use std::time; pub trait ProgrammingLanguageInterface { fn get_language_name(&self) -> String; fn get_source_file_suffix(&self) -> String; fn run_computation(&mut self, _request: ComputationRequest) -> ComputationResponse { ComputationResponse { main_output: Err(format!("Computation pipeline not implemented")), global_output_stats: GlobalOutputStats::default(), debug_responses: vec![], } } fn request_meta(&mut self, _request: LangMetaRequest) -> LangMetaResponse { LangMetaResponse::Custom { kind: format!("not-implemented"), value: format!("") } } } pub struct ComputationRequest<'a> { pub source: &'a str, pub debug_requests: Vec, } pub struct ComputationResponse { pub main_output: Result, pub global_output_stats: GlobalOutputStats, pub debug_responses: Vec, } pub struct DebugRequest { pub kind: String, pub value: String } pub struct DebugResponse { pub kind: String, pub value: String } pub enum LangMetaRequest { StageNames, Docs { source: String, }, Custom { kind: String, value: String }, ImmediateDebug(DebugRequest), } pub enum LangMetaResponse { StageNames(Vec), Docs { doc_string: String, }, Custom { kind: String, value: String }, ImmediateDebug(DebugResponse), } #[derive(Default, Debug)] pub struct GlobalOutputStats { total_duration: Option, stage_durations: Option> } /* impl GlobalOutputStats { fn get_timing(&self) -> Option { if self.durations.len() != 0 { let mut buf = String::new(); write!(&mut buf, "Timing: ").unwrap(); for duration in self.durations.iter() { let timing = (duration.as_secs() as f64) + (duration.subsec_nanos() as f64 * 1e-9); write!(&mut buf, "{}s, ", timing).unwrap() } write!(&mut buf, "\n").unwrap(); Some(buf) } else { None } } } */