Implement FromStr for JsString
#![doc(html_root_url = "https://docs.rs/js-sys/0.2")]
+use std::convert;
use std::f64;
use std::fmt;
use std::mem;
+use std::str;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
@@ -4297,6 +4299,13 @@ impl fmt::Debug for JsString {
}
}
+impl str::FromStr for JsString {
+ type Err = convert::Infallible;
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
+ Ok(JsString::from(s))
+ }
+}
+
// Symbol
#[wasm_bindgen]
extern "C" {
