mirror of
https://github.com/penpot/penpot.git
synced 2025-05-25 15:16:10 +02:00
🔧 Add dummy rust project + build scripts with wasm-pack
This commit is contained in:
parent
f0cecfd517
commit
cd6a739abb
6 changed files with 227 additions and 0 deletions
27
frontend/renderer/src/lib.rs
Normal file
27
frontend/renderer/src/lib.rs
Normal file
|
@ -0,0 +1,27 @@
|
|||
use wasm_bindgen::prelude::*;
|
||||
|
||||
pub fn add(left: u64, right: u64) -> u64 {
|
||||
left + right
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
#[wasm_bindgen(js_namespace = console)]
|
||||
fn log(s: &str);
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn print(msg: &str) {
|
||||
log(msg);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn it_works() {
|
||||
let result = add(2, 2);
|
||||
assert_eq!(result, 4);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue