pub trait Eval {
type Value: Value;
type Error;
// Required methods
fn eval(&mut self, code: &[u8]) -> Result<Self::Value, Self::Error>;
fn eval_os_str(&mut self, code: &OsStr) -> Result<Self::Value, Self::Error>;
fn eval_file(&mut self, file: &Path) -> Result<Self::Value, Self::Error>;
}
Expand description
Execute code and retrieve its result.
Required Associated Types§
Required Methods§
Sourcefn eval(&mut self, code: &[u8]) -> Result<Self::Value, Self::Error>
fn eval(&mut self, code: &[u8]) -> Result<Self::Value, Self::Error>
Eval code on the Artichoke interpreter using the current parser context.
§Errors
If an exception is raised on the interpreter, then an error is returned.
Sourcefn eval_os_str(&mut self, code: &OsStr) -> Result<Self::Value, Self::Error>
Available on crate feature std
only.
fn eval_os_str(&mut self, code: &OsStr) -> Result<Self::Value, Self::Error>
std
only.Sourcefn eval_file(&mut self, file: &Path) -> Result<Self::Value, Self::Error>
Available on crate feature std
only.
fn eval_file(&mut self, file: &Path) -> Result<Self::Value, Self::Error>
std
only.Eval code on the Artichoke interpreter using a new file Context
given
a file path.
§Errors
If an exception is raised on the interpreter, then an error is returned.
If path
does not exist or code cannot be read, an error is returned.