Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/builders/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,26 @@ impl ModuleBuilder<'_> {
}
}

/// Overrides module name.
///
/// # Arguments
///
/// * `name` - The name of the extension.
pub fn name(mut self, name: impl Into<String>) -> Self {
self.name = name.into();
self
}

/// Overrides module version.
///
/// # Arguments
///
/// * `version` - The current version of the extension.
pub fn version(mut self, version: impl Into<String>) -> Self {
self.version = version.into();
self
}

/// Sets the startup function for the extension.
///
/// # Arguments
Expand Down Expand Up @@ -373,6 +393,18 @@ mod tests {
assert!(builder.enums.is_empty());
}

#[test]
fn test_name() {
let builder = ModuleBuilder::new("test", "1.0").name("new_test");
assert_eq!(builder.name, "new_test");
}

#[test]
fn test_version() {
let builder = ModuleBuilder::new("test", "1.0").version("2.0");
assert_eq!(builder.version, "2.0");
}

#[test]
fn test_startup_function() {
let builder =
Expand Down
Loading