Functionality to request/respond to meta items

This commit is contained in:
greg 2019-03-19 19:12:32 -07:00
parent d3f9430a18
commit 61972410ea
3 changed files with 22 additions and 2 deletions

View File

@ -21,7 +21,7 @@ use std::cell::RefCell;
use std::rc::Rc;
use itertools::Itertools;
use schala_repl::{ProgrammingLanguageInterface, ComputationRequest, ComputationResponse, GlobalOutputStats};
use schala_repl::{ProgrammingLanguageInterface, ComputationRequest, ComputationResponse, LangMetaRequest, LangMetaResponse, GlobalOutputStats};
macro_rules! bx {
($e:expr) => { Box::new($e) }

View File

@ -15,6 +15,10 @@ pub trait ProgrammingLanguageInterface {
fn repl_request(&self, repl_request: String) -> String {
format!("<<No custom interpreter directives or help info specified>>")
}
fn request_meta(&mut self, _request: LangMetaRequest) -> LangMetaResponse {
LangMetaResponse::Custom { kind: format!("not-implemented"), value: format!("") }
}
}
pub struct ComputationRequest<'a> {
@ -38,6 +42,22 @@ pub struct DebugResponse {
value: String
}
pub enum LangMetaRequest {
StageNames,
Custom {
kind: String,
value: String
}
}
pub enum LangMetaResponse {
StageNames(Vec<String>),
Custom {
kind: String,
value: String
}
}
#[derive(Default, Debug)]
pub struct GlobalOutputStats {
total_duration: Option<time::Duration>,

View File

@ -24,7 +24,7 @@ mod repl;
mod language;
mod webapp;
pub use language::{ProgrammingLanguageInterface, ComputationRequest, ComputationResponse, GlobalOutputStats};
pub use language::{ProgrammingLanguageInterface, ComputationRequest, ComputationResponse, LangMetaRequest, LangMetaResponse, GlobalOutputStats};
include!(concat!(env!("OUT_DIR"), "/static.rs"));
const VERSION_STRING: &'static str = "0.1.0";