Updated math lib and import in cargo toml file
This commit is contained in:
parent
0ae0b214bc
commit
cc6b0c38db
@ -19,6 +19,8 @@ default = ["console_error_panic_hook"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
wasm-bindgen = "0.2.63"
|
wasm-bindgen = "0.2.63"
|
||||||
|
|
||||||
|
math = { path = "math", version = "0.1.0" }
|
||||||
|
|
||||||
# The `console_error_panic_hook` crate provides better debugging of panics by
|
# The `console_error_panic_hook` crate provides better debugging of panics by
|
||||||
# logging them with `console.error`. This is great for development, but requires
|
# 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
|
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
mod math {
|
#[allow(dead_code)]
|
||||||
#[allow(dead_code)]
|
pub fn sum(a: i32, b: i32) -> i32 {
|
||||||
pub fn sum(a: i32, b: i32) -> i32 {
|
|
||||||
a + b
|
a + b
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@ -11,6 +9,6 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn it_works() {
|
fn it_works() {
|
||||||
assert_eq!(math::sum(10, 10), 20);
|
assert_eq!(sum(10, 10), 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
6
src/main.rs
Normal file
6
src/main.rs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
use math;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let sum = math::sum(1, 2);
|
||||||
|
println!("Sum number {}", sum)
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
#[allow(dead_code)]
|
||||||
pub fn set_panic_hook() {
|
pub fn set_panic_hook() {
|
||||||
// When the `console_error_panic_hook` feature is enabled, we can call the
|
// When the `console_error_panic_hook` feature is enabled, we can call the
|
||||||
// `set_panic_hook` function at least once during initialization, and then
|
// `set_panic_hook` function at least once during initialization, and then
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/math/src" isTestSource="false" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/math/target" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
|
Loading…
Reference in New Issue
Block a user