1
0
dust/src/value/function.rs

29 lines
649 B
Rust
Raw Normal View History

2023-08-22 15:40:50 +00:00
use std::fmt::{self, Display, Formatter};
use serde::{Deserialize, Serialize};
use crate::{eval, eval_with_context, Result, Value, VariableMap};
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
pub struct Function(String);
impl Function {
pub fn new(body: &str) -> Self {
Function(body.to_string())
}
pub fn run(&self) -> Result<Value> {
2023-09-29 06:53:31 +00:00
todo!()
2023-08-22 15:40:50 +00:00
}
pub fn run_with_context(&self, context: &mut VariableMap) -> Result<Value> {
2023-09-29 06:53:31 +00:00
todo!()
2023-08-22 15:40:50 +00:00
}
}
impl Display for Function {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
}
}