mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-29 04:31:33 +00:00
Implement a js_name
customization
This'll allow binding multiple signatures of a JS function as well as otherwise changing the name of the JS function you're calling from the Rust function that you're defining. Closes #72
This commit is contained in:
@ -34,6 +34,7 @@ pub enum ImportKind {
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct ImportFunction {
|
||||
pub shim: String,
|
||||
pub module: Option<String>,
|
||||
pub catch: bool,
|
||||
pub method: bool,
|
||||
@ -49,6 +50,7 @@ pub struct ImportFunction {
|
||||
pub struct ImportStatic {
|
||||
pub module: Option<String>,
|
||||
pub name: String,
|
||||
pub shim: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@ -110,17 +112,6 @@ pub fn struct_function_export_name(struct_: &str, f: &str) -> String {
|
||||
return name
|
||||
}
|
||||
|
||||
pub fn mangled_import_name(struct_: Option<&str>, f: &str) -> String {
|
||||
match struct_ {
|
||||
Some(s) => format!("__wbg_s_{}_{}", s, f),
|
||||
None => format!("__wbg_f_{}", f),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn static_import_shim_name(statik: &str) -> String {
|
||||
format!("__wbg_field_import_shim_{}", statik)
|
||||
}
|
||||
|
||||
pub type Type = char;
|
||||
|
||||
pub const TYPE_VECTOR_JSVALUE: char = '\u{5b}';
|
||||
|
Reference in New Issue
Block a user