Alex Crichton
44738e049a
Add warnings about UTF-16 vs UTF-8 strings
...
This commit aims to address #1348 via a number of strategies:
* Documentation is updated to warn about UTF-16 vs UTF-8 problems
between JS and Rust. Notably documenting that `as_string` and handling
of arguments is lossy when there are lone surrogates.
* A `JsString::is_valid_utf16` method was added to test whether
`as_string` is lossless or not.
The intention is that most default behavior of `wasm-bindgen` will
remain, but where necessary bindings will use `JsString` instead of
`str`/`String` and will manually check for `is_valid_utf16` as
necessary. It's also hypothesized that this is relatively rare and not
too performance critical, so an optimized intrinsic for `is_valid_utf16`
is not yet provided.
Closes #1348
2019-04-05 08:11:50 -07:00
Alex Crichton
7ecf4aae87
cargo +nightly fmt --all
...
Rustfmt all the things!
2018-09-26 08:26:00 -07:00
Nick Fitzgerald
e3d2ea2628
js-sys: Catch exceptions thrown in Reflect APIs
...
Proxies passed to Reflect APIs can throw for any of these operations and it is a
bit of a mess.
2018-09-25 14:30:26 -07:00
Anton Danilkin
f808594efa
Add String.raw
2018-09-20 00:40:14 +03:00
Alex Crichton
a4bf239eff
Merge pull request #739 from Hywan/string-replace-regexp
...
feat(js-sys) Implement `String.replace(&str, …)`
2018-08-20 07:55:05 -07:00
Ivan Enderlin
1e27b588e2
feat(js-sys) Implement String.replace(&str, …)
.
2018-08-20 11:01:56 +02:00
Ivan Enderlin
a9a1e69f30
feat(js-sys) Implement String.split
with regexp.
2018-08-20 10:42:12 +02:00
Danielle Pham
4f294224f0
Add bindings for String.prototype.split
2018-08-19 15:09:45 -04:00
Danielle Pham
8698084a43
Add binding for String.prototype.search
2018-08-19 14:52:10 -04:00
Danielle Pham
44877880bb
Add bindings for String.prototype.replace
2018-08-19 14:42:22 -04:00
Danielle Pham
7b53b1c88e
Add binding for String.prototype.match
2018-08-19 13:59:00 -04:00
Alex Crichton
a12fc46a55
Merge pull request #728 from quelledanielle/js_string_from_code_point
...
Add bindings for String.from_code_point
2018-08-18 22:08:48 -07:00
Danielle Pham
27d48ad267
Add bindings for String.from_code_point
2018-08-18 21:35:38 -04:00
Danielle Pham
0d3f706195
Add binding for String.prototype.localeCompare
2018-08-18 21:05:02 -04:00
Alex Crichton
c0c27775f3
Merge pull request #681 from sepiropht/master
...
[670] add extends for some types
2018-08-13 18:39:53 -06:00
sepiropht
96c24c47a2
add extends for JsString
2018-08-14 00:47:36 +02:00
Danielle Pham
30fc99b724
Use u32 params for String.from_char_code bindings
2018-08-13 17:03:58 -04:00
Danielle Pham
fd5958b51b
Add bindings for String.from_char_code
2018-08-13 00:19:43 -04:00
Nick Fitzgerald
64591ef403
Js sys use &str arguments ( #555 )
...
* js-sys: imports should take &str parameters instead of &JsString
* js-sys: Imports should take Option<&str> instead of Option<String>
2018-07-25 18:50:30 -05:00
Alex Crichton
f3e34d854d
Port JsString
tests to wasm
2018-07-20 13:35:46 -07:00