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 bigint_threshold: crate::lexer::DEFAULT_BIGINT_THRESHOLD,
25 }
26 }
27
28 pub fn with_all_permissions() -> Self {
30 Self::with_permissions(IOPermissions::allow_all())
31 }
32
33 pub fn with_stdlib() -> Result<Self, String> {
39 let mut engine = Self::new();
40 stdlib::preload_stdlib(&mut engine)?;
41 Ok(engine)
42 }
43}
44
45impl Default for Aether {
46 fn default() -> Self {
47 Self::new()
48 }
49}