Add new types for ProgrammingLanguageInterface
This commit is contained in:
parent
8d8d7d8bf8
commit
5b35c2a036
@ -170,6 +170,48 @@ pub trait ProgrammingLanguageInterface {
|
||||
fn get_doc(&self, _commands: &Vec<&str>) -> Option<String> {
|
||||
None
|
||||
}
|
||||
|
||||
/* ------- */
|
||||
// new trait methods
|
||||
//
|
||||
//
|
||||
|
||||
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 repl_request(&self, repl_request: String) -> String {
|
||||
format!("Repl request not implemented")
|
||||
}
|
||||
}
|
||||
|
||||
struct ComputationRequest {
|
||||
pub source: String,
|
||||
pub debug_requests: Vec<DebugRequest>,
|
||||
}
|
||||
|
||||
struct ComputationResponse {
|
||||
pub main_output: Result<String, String>,
|
||||
pub global_output_stats: GlobalOutputStats,
|
||||
pub debug_responses: Vec<DebugResponse>,
|
||||
}
|
||||
|
||||
struct DebugRequest {
|
||||
kind: String,
|
||||
value: String
|
||||
}
|
||||
|
||||
struct DebugResponse {
|
||||
kind: String,
|
||||
value: String
|
||||
}
|
||||
|
||||
#[derive(Default, Debug)]
|
||||
struct GlobalOutputStats {
|
||||
total_duration: Option<time::Duration>,
|
||||
stage_durations: Option<Vec<(String, time::Duration)>>
|
||||
}
|
||||
|
@ -103,6 +103,17 @@ impl NewRepl {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* --------------------------------------------- */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
pub struct Repl {
|
||||
options: EvalOptions,
|
||||
languages: Vec<Box<ProgrammingLanguageInterface>>,
|
||||
|
Loading…
Reference in New Issue
Block a user