pub struct ModuleBuilder { /* private fields */ }
Expand description
Helper to build modules in Rust code.
Implementations§
Source§impl ModuleBuilder
impl ModuleBuilder
Sourcepub fn new(name: &str, scope: Scope) -> ModuleBuilder
pub fn new(name: &str, scope: Scope) -> ModuleBuilder
Creates a new ModuleBuilder
for the given scope.
Sourcepub fn add_constant<T: Into<Value>>(self, name: &str, value: T) -> Self
pub fn add_constant<T: Into<Value>>(self, name: &str, value: T) -> Self
Adds a constant value to the module.
Sourcepub fn add_doc(self, name: &str, doc: &str) -> Self
pub fn add_doc(self, name: &str, doc: &str) -> Self
Adds a documentation string for the given name.
Sourcepub fn add_function(
self,
name: &str,
callback: FunctionImpl,
arity: Arity,
doc: Option<&'static str>,
) -> Self
pub fn add_function( self, name: &str, callback: FunctionImpl, arity: Arity, doc: Option<&'static str>, ) -> Self
Adds a function to the module.
Sourcepub fn add_value_with_name<F>(self, name: &str, f: F) -> Self
pub fn add_value_with_name<F>(self, name: &str, f: F) -> Self
Adds a value to the module using the generated name value.
Auto Trait Implementations§
impl Freeze for ModuleBuilder
impl !RefUnwindSafe for ModuleBuilder
impl !Send for ModuleBuilder
impl !Sync for ModuleBuilder
impl Unpin for ModuleBuilder
impl !UnwindSafe for ModuleBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more