aether/api/
constructors.rs1use super::Aether;
2use crate::builtins::IOPermissions;
3use crate::evaluator::Evaluator;
4use crate::optimizer::Optimizer;
5use crate::stdlib;
6
7impl Aether {
8 pub fn new() -> Self {
15 Self::with_permissions(IOPermissions::default())
16 }
17
18 pub fn with_permissions(permissions: IOPermissions) -> Self {
20 Aether {
21 evaluator: Evaluator::with_permissions(permissions),
22 cache: crate::cache::ASTCache::new(),
23 optimizer: Optimizer::new(),
24 }
25 }
26
27 pub fn with_all_permissions() -> Self {
29 Self::with_permissions(IOPermissions::allow_all())
30 }
31
32 pub fn with_stdlib() -> Result<Self, String> {
37 let mut engine = Self::with_all_permissions();
38 stdlib::preload_stdlib(&mut engine)?;
39 Ok(engine)
40 }
41}
42
43impl Default for Aether {
44 fn default() -> Self {
45 Self::new()
46 }
47}