mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-18 07:21:24 +00:00
Add support for constructing JsValue instances generically
This commit is contained in:
committed by
Alex Crichton
parent
e6a483f906
commit
73619b5d15
@ -88,6 +88,15 @@ pub struct CustomTypeName {
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
pub fn new_function(struct_name: &str) -> String {
|
||||
let mut name = format!("__wbg_");
|
||||
name.extend(struct_name
|
||||
.chars()
|
||||
.flat_map(|s| s.to_lowercase()));
|
||||
name.push_str("_new");
|
||||
return name
|
||||
}
|
||||
|
||||
pub fn free_function(struct_name: &str) -> String {
|
||||
let mut name = format!("__wbg_");
|
||||
name.extend(struct_name
|
||||
|
Reference in New Issue
Block a user