Struct ketos::module::ModuleBuilder
[−]
[src]
#[must_use]pub struct ModuleBuilder { /* fields omitted */ }
Helper to build modules in Rust code.
Methods
impl ModuleBuilder
[src]
fn new(name: &str, scope: Scope) -> ModuleBuilder
Creates a new ModuleBuilder
for the given scope.
fn add_constant<T: Into<Value>>(self, name: &str, value: T) -> Self
Adds a constant value to the module.
fn add_doc(self, name: &str, doc: &str) -> Self
Adds a documentation string for the given name.
fn add_function(self,
name: &str,
callback: FunctionImpl,
arity: Arity,
doc: Option<&'static str>)
-> Self
name: &str,
callback: FunctionImpl,
arity: Arity,
doc: Option<&'static str>)
-> Self
Adds a function to the module.
fn add_value(self, name: &str, value: Value) -> Self
Adds a value to the module.
fn add_value_with_name<F>(self, name: &str, f: F) -> Self where F: FnOnce(Name) -> Value
Adds a value to the module using the generated name value.
fn finish(self) -> Module
Consumes the builder and returns the new Module
.