char

T parameter&T parameter&mut T parameterT return valueOption<T> parameterOption<T> return valueJavaScript representation
YesNoNoYesNoNoA JavaScript string value

Example Rust Usage


# #![allow(unused_variables)]
#fn main() {
use wasm_bindgen::prelude::*;

#[wasm_bindgen]
pub fn take_char_by_value(x: char) {}

#[wasm_bindgen]
pub fn return_char() -> char {
    '🚀'
}

#}

Example JavaScript Usage

import {
  take_char_by_value,
  return_char,
} from './guide_supported_types_examples';

take_char_by_value('a');

let c = return_char();
console.log(typeof c); // "string"