mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-12 20:41:24 +00:00
guide: Add bool
example to supported types section
This commit is contained in:
9
examples/guide-supported-types-examples/bool.js
Normal file
9
examples/guide-supported-types-examples/bool.js
Normal file
@ -0,0 +1,9 @@
|
||||
import {
|
||||
take_char_by_value,
|
||||
return_char,
|
||||
} from './guide_supported_types_examples';
|
||||
|
||||
take_bool_by_value(true);
|
||||
|
||||
let b = return_bool();
|
||||
console.log(typeof b); // "boolean"
|
9
examples/guide-supported-types-examples/src/bool.rs
Normal file
9
examples/guide-supported-types-examples/src/bool.rs
Normal file
@ -0,0 +1,9 @@
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn take_bool_by_value(x: bool) {}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn return_bool() -> bool {
|
||||
true
|
||||
}
|
@ -8,3 +8,4 @@ pub mod exported_types;
|
||||
pub mod str;
|
||||
pub mod string;
|
||||
pub mod char;
|
||||
pub mod bool;
|
||||
|
Reference in New Issue
Block a user