mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-24 18:21:33 +00:00
Use u32 params for String.from_char_code bindings
This commit is contained in:
@ -2950,23 +2950,23 @@ extern "C" {
|
|||||||
/// There are a few bindings to `from_char_code` in `js-sys`: `from_char_code1`, `from_char_code2`, etc...
|
/// There are a few bindings to `from_char_code` in `js-sys`: `from_char_code1`, `from_char_code2`, etc...
|
||||||
/// with different arities.
|
/// with different arities.
|
||||||
#[wasm_bindgen(static_method_of = JsString, js_class = "String", js_name = fromCharCode)]
|
#[wasm_bindgen(static_method_of = JsString, js_class = "String", js_name = fromCharCode)]
|
||||||
pub fn from_char_code1(a: f64) -> JsString;
|
pub fn from_char_code1(a: u32) -> JsString;
|
||||||
|
|
||||||
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode
|
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode
|
||||||
#[wasm_bindgen(static_method_of = JsString, js_class = "String", js_name = fromCharCode)]
|
#[wasm_bindgen(static_method_of = JsString, js_class = "String", js_name = fromCharCode)]
|
||||||
pub fn from_char_code2(a: f64, b: f64) -> JsString;
|
pub fn from_char_code2(a: u32, b: u32) -> JsString;
|
||||||
|
|
||||||
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode
|
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode
|
||||||
#[wasm_bindgen(static_method_of = JsString, js_class = "String", js_name = fromCharCode)]
|
#[wasm_bindgen(static_method_of = JsString, js_class = "String", js_name = fromCharCode)]
|
||||||
pub fn from_char_code3(a: f64, b: f64, c: f64) -> JsString;
|
pub fn from_char_code3(a: u32, b: u32, c: u32) -> JsString;
|
||||||
|
|
||||||
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode
|
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode
|
||||||
#[wasm_bindgen(static_method_of = JsString, js_class = "String", js_name = fromCharCode)]
|
#[wasm_bindgen(static_method_of = JsString, js_class = "String", js_name = fromCharCode)]
|
||||||
pub fn from_char_code4(a: f64, b: f64, c: f64, d: f64) -> JsString;
|
pub fn from_char_code4(a: u32, b: u32, c: u32, d: u32) -> JsString;
|
||||||
|
|
||||||
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode
|
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode
|
||||||
#[wasm_bindgen(static_method_of = JsString, js_class = "String", js_name = fromCharCode)]
|
#[wasm_bindgen(static_method_of = JsString, js_class = "String", js_name = fromCharCode)]
|
||||||
pub fn from_char_code5(a: f64, b: f64, c: f64, d: f64, e: f64) -> JsString;
|
pub fn from_char_code5(a: u32, b: u32, c: u32, d: u32, e: u32) -> JsString;
|
||||||
|
|
||||||
/// The `includes()` method determines whether one string may be found
|
/// The `includes()` method determines whether one string may be found
|
||||||
/// within another string, returning true or false as appropriate.
|
/// within another string, returning true or false as appropriate.
|
||||||
|
@ -61,8 +61,8 @@ fn ends_with() {
|
|||||||
#[wasm_bindgen_test]
|
#[wasm_bindgen_test]
|
||||||
fn from_char_code() {
|
fn from_char_code() {
|
||||||
let s = "½+¾=";
|
let s = "½+¾=";
|
||||||
let codes : Vec<f64> = s.chars()
|
let codes : Vec<u32> = s.chars()
|
||||||
.map(|char| char as u32 as f64)
|
.map(|char| char as u32)
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
assert_eq!(JsString::from_char_code1(codes[0]), "½");
|
assert_eq!(JsString::from_char_code1(codes[0]), "½");
|
||||||
|
Reference in New Issue
Block a user