[][src]Struct ketos::module::ModuleBuilder

#[must_use]
pub struct ModuleBuilder { /* fields omitted */ }

Helper to build modules in Rust code.

Methods

impl ModuleBuilder[src]

pub fn new(name: &str, scope: Scope) -> ModuleBuilder[src]

Creates a new ModuleBuilder for the given scope.

pub fn add_constant<T: Into<Value>>(self, name: &str, value: T) -> Self[src]

Adds a constant value to the module.

pub fn add_doc(self, name: &str, doc: &str) -> Self[src]

Adds a documentation string for the given name.

pub fn add_function(
    self,
    name: &str,
    callback: FunctionImpl,
    arity: Arity,
    doc: Option<&'static str>
) -> Self
[src]

Adds a function to the module.

pub fn add_value(self, name: &str, value: Value) -> Self[src]

Adds a value to the module.

pub fn add_value_with_name<F>(self, name: &str, f: F) -> Self where
    F: FnOnce(Name) -> Value
[src]

Adds a value to the module using the generated name value.

pub fn finish(self) -> Module[src]

Consumes the builder and returns the new Module.

Auto Trait Implementations

Blanket Implementations

impl<T> AnyValue for T where
    T: Any
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.