diff --git a/Cargo.toml b/Cargo.toml
index 62e8054..5b6281c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,6 +19,8 @@ default = ["console_error_panic_hook"]
[dependencies]
wasm-bindgen = "0.2.63"
+math = { path = "math", version = "0.1.0" }
+
# The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
@@ -37,4 +39,4 @@ wasm-bindgen-test = "0.3.13"
[profile.release]
# Tell `rustc` to optimize for small code size.
-opt-level = "s"
+opt-level = "s"
\ No newline at end of file
diff --git a/math/src/lib.rs b/math/src/lib.rs
index 4983dfa..07fd3ea 100644
--- a/math/src/lib.rs
+++ b/math/src/lib.rs
@@ -1,8 +1,6 @@
-mod math {
- #[allow(dead_code)]
- pub fn sum(a: i32, b: i32) -> i32 {
- a + b
- }
+#[allow(dead_code)]
+pub fn sum(a: i32, b: i32) -> i32 {
+ a + b
}
#[cfg(test)]
@@ -11,6 +9,6 @@ mod tests {
#[test]
fn it_works() {
- assert_eq!(math::sum(10, 10), 20);
+ assert_eq!(sum(10, 10), 20);
}
}
\ No newline at end of file
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..2cd0ee5
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,6 @@
+use math;
+
+fn main() {
+ let sum = math::sum(1, 2);
+ println!("Sum number {}", sum)
+}
\ No newline at end of file
diff --git a/src/utils.rs b/src/utils.rs
index b1d7929..8a790b9 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -1,3 +1,4 @@
+#[allow(dead_code)]
pub fn set_panic_hook() {
// When the `console_error_panic_hook` feature is enabled, we can call the
// `set_panic_hook` function at least once during initialization, and then
@@ -7,4 +8,4 @@ pub fn set_panic_hook() {
// https://github.com/rustwasm/console_error_panic_hook#readme
#[cfg(feature = "console_error_panic_hook")]
console_error_panic_hook::set_once();
-}
+}
\ No newline at end of file
diff --git a/wasmweb-sample.iml b/wasmweb-sample.iml
index d7b1edb..d171581 100644
--- a/wasmweb-sample.iml
+++ b/wasmweb-sample.iml
@@ -5,6 +5,8 @@
+
+