Begin converting to new built-in API

This commit is contained in:
Jeff 2023-11-28 19:18:04 -05:00
parent a1f3dcb107
commit fc898e28e2

View File

@ -0,0 +1,19 @@
use crate::{BuiltInFunction, Error, Result, Value};
pub struct Assert;
impl BuiltInFunction for Assert {
fn name(&self) -> &'static str {
"assert"
}
fn run(&self, arguments: &[Value]) -> Result<Value> {
for argument in arguments {
if !argument.as_boolean()? {
return Err(Error::AssertFailed);
}
}
Ok(Value::Empty)
}
}