Struct ketos::interpreter::Builder [] [src]

pub struct Builder {
    // some fields omitted
}

Builds an Interpreter with configured parameters.

Some methods are mutually exclusive. For example, a Scope contains a ModuleLoader instance. Therefore, the builder will panic if both a Scope and a ModuleLoader are supplied.

Example


let interp = Builder::new()
    .name("foo")
    // ...
    .finish();

// ...

Methods

impl Builder
[src]

fn new() -> Builder

Creates a new Builder.

fn name(self, name: &'static str) -> Self

Sets the name of the new scope.

fn context(self, ctx: Context) -> Self

Sets the context of the new interpreter.

fn scope(self, scope: Scope) -> Self

Sets the scope in the new context.

fn restrict(self, restrict: RestrictConfig) -> Self

Sets the restriction configuration in the new context.

fn io(self, io: Rc<GlobalIo>) -> Self

Sets the I/O handles in the new scope.

fn module_loader(self, loader: Box<ModuleLoader>) -> Self

Sets the module loader in the new scope.

fn search_paths(self, paths: Vec<PathBuf>) -> Self

Sets the search paths for a new FileModuleLoader.

fn finish(self) -> Interpreter

Consumes the Builder and creates an Interpreter.