use super::Aether;
use crate::builtins::IOPermissions;
use crate::evaluator::Evaluator;
use crate::optimizer::Optimizer;
use crate::stdlib;
impl Aether {
pub fn new() -> Self {
Self::with_permissions(IOPermissions::default())
}
pub fn with_permissions(permissions: IOPermissions) -> Self {
Aether {
evaluator: Evaluator::with_permissions(permissions),
cache: crate::cache::ASTCache::new(),
optimizer: Optimizer::new(),
}
}
pub fn with_all_permissions() -> Self {
Self::with_permissions(IOPermissions::allow_all())
}
pub fn with_stdlib() -> Result<Self, String> {
let mut engine = Self::with_all_permissions();
stdlib::preload_stdlib(&mut engine)?;
Ok(engine)
}
}
impl Default for Aether {
fn default() -> Self {
Self::new()
}
}