|
|
@ -112,13 +112,15 @@ pub enum Value
|
|
|
|
String(String),
|
|
|
|
String(String),
|
|
|
|
Symbol(String),
|
|
|
|
Symbol(String),
|
|
|
|
List(Vec<Value>),
|
|
|
|
List(Vec<Value>),
|
|
|
|
|
|
|
|
|
|
|
|
Command(Box<dyn Command>),
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Trait for commands.
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # Defining commands
|
|
|
|
|
|
|
|
/// A command object should be created once only, and then referenced and executed using `params` and through mutating `cx`.
|
|
|
|
pub trait Command: fmt::Debug
|
|
|
|
pub trait Command: fmt::Debug
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fn execute(self: Box<Self>, cx: &mut Context<'_>, params: Vec<Value>) -> eyre::Result<()>;
|
|
|
|
fn execute(&self, cx: &mut Context<'_>, params: Vec<Value>) -> eyre::Result<()>;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Command structurally parsed.
|
|
|
|
/// Command structurally parsed.
|
|
|
|