We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent af082f3 commit cb27d4cCopy full SHA for cb27d4c
1 file changed
src/lib.rs
@@ -4,17 +4,21 @@ use wasm_bindgen::prelude::*;
4
// Import the console logging functionality from the web_sys crate
5
use web_sys::console;
6
7
+
8
#[wasm_bindgen]
9
pub fn greet(name: &str) -> String {
- format!("DLC, {}!", name)
10
+ // Ensure the string is formatted correctly.
11
+ format!("Hello, {}!", name)
12
}
13
14
15
pub fn log(msg: &str) {
16
+ // Safely log the message to the browser's console.
17
console::log_1(&msg.into());
18
19
20
21
pub fn add(a: i32, b: i32) -> i32 {
22
+ // Return the sum of the two integers.
23
a + b
-}
24
+}
0 commit comments